How to Check PHP Version

Author: Peter Berry
Date Of Creation: 16 February 2021
Update Date: 1 July 2024
Anonim
how to check PHP version
Video: how to check PHP version

Content

If you are interested in adding new features to your website or are trying to identify a programming bug, you may have to check the PHP version your server is using. You can do this by running a simple PHP file on the server. Or, you can also check the PHP version installed on the local computer using the Command Prompt command line interpreter application on Windows or the Terminal emulator on the Mac.

Steps

Method 1 of 2: Server

  1. Open a code or text editor. You can use Notepad or TextEdit, but don't use word processing software like Microsoft Word.

  2. Enter the following code. When running on your server, this little snippet will return PHP version information.
  3. Save as PHP file. Click "File" → "Save as" and give the file a name. Add a tail at the end of the name. Choose a simple name, such as.

  4. Create a more detailed report (optional). The file above will tell you what the current version of PHP is. However, if you want more information, such as system information, release date, available commands, API information, etc. You can use the command. Please save the file as.
  5. Upload your file (s) to the server. You may have to use an FTP client program. You can also get it through the server's administrative console. Leave the file in the root directory of your server.
    • Please refer to the article on how to upload files to your server.

  6. Open the file in your browser. Once the files have been uploaded to the server, you can use your browser to download them. Find the file location on the server. For example, if you leave them at the root of your domain, go to.
    • To view all data, go to.
    advertisement

Method 2 of 2: Local PHP version

  1. Open Command Prompt or Terminal. If PHP is installed locally, you can use Command Prompt or Terminal to check the version number. You can also do this if you use SSH to make a remote connection to the server via the command line.
    • Windows - Press ⊞ Win+R and type cmd.
    • Mac - Open Terminal from the Utilities folder.
    • Linux - Open Terminal from the desktop or by pressing Ctrl+Alt+T.
  2. Enter the command to check the PHP version number. When running the command, the installed PHP version will be displayed.
    • Windows, Mac, Linux - php -v
  3. Fix the version number not appearing on Windows. A common problem for Windows users is that PHP is not in the system path, so the message will appear (can not determine whether 'php.exe' is internal or external, active program or batch file processing).
    • Find your file location. That is usually, but you may have changed it during the installation.
    • Type set PATH =% PATH%; C: php php.exe and press ↵ Enter. Change its actual position if it is not currently located.
    • Run again php -v. You should now see the version number.
    advertisement