How to Check PHP Version

If you're interested in implementing new features on your website, or are trying to pinpoint a bug, you may need to check the version of PHP that your server is currently running. You can check the version by running a simple PHP file on...

Method 1 of 2:

Web Server

  1. Picture 1 of How to Check PHP Version
    Open a text or code editor. You can use Notepad or TextEdit. Don't use a word processor such as Microsoft Word.
  2. Picture 2 of How to Check PHP Version
    Enter the following code. This small piece of code will return the PHP version information when it is run on your web server.[1]
     
  3. Picture 3 of How to Check PHP Version
    Save the file as a PHP file. Click "File" → "Save as" and then give the file a name. Add the .php extension to the end of the file name. Name it something simple, like version.php.
  4. Picture 4 of How to Check PHP Version
    Create a more detailed report (optional). The file above will output your current PHP version number, but if you want more information, such as system info, build dates, available commands, API information, and more, you can use the phpinfo() command. Save the file as info.php.
     
  5. Picture 5 of How to Check PHP Version
    Upload the file(s) to your web server. You may have to use an FTP client, or you may be able to upload through your server's admin control panel. Place the file(s) in the root directory of your web server.
    1. Click here for more details on uploading files to your web server.
  6. Picture 6 of How to Check PHP Version
    Open the file in your web browser. Once the file has been uploaded to the server, you can use your browser to load the file. Navigate to the location of the file on your server. For example, if you placed it in the root directory of your domain, you would visit www.yourdomain.com/version.php.
    1. To see the full readout, visit www.yourdomain.com/info.php.
Method 2 of 2:

Local PHP Version

  1. Picture 7 of How to Check PHP Version
    Open the Command Prompt or Terminal. If you have PHP installed locally, you can use the Command Prompt or Terminal to check the version. This also works if you use SSH to create a remote connection to your server via the command line.
    1. Windows - Press Win+R and type cmd.
    2. Mac - Open Terminal from the Utilities folder.
    3. Linux - Open Terminal from the dash, or by pressing Ctrl+Alt+T.
  2. Picture 8 of How to Check PHP Version
    Enter the command to check the PHP version. When you run the command, the installed version of PHP will be displayed.
    1. Windows, Mac, Linux - php -v
  3. Picture 9 of How to Check PHP Version
    Fix the version not appearing in Windows. A common problem for Windows users is PHP not being included in the system path, resulting in the message 'php.exe' is not recognized as an internal or external command, operable program or batch file.[2]
    1. Find the location of your php.exe file. This is usually C:phpphp.exe, but you may have changed this during installation.
    2. Type set PATH=%PATH%;C:phpphp.exe and press Enter. Change the actual location if yours is different.
    3. Run php -v again. You should now be able to see the version number.
Update 05 March 2020
Category

System

Mac OS X

Hardware

Game

Tech info

Technology

Science

Life

Application

Electric

Program

Mobile