PDF download Download Article
A step-by-step guide to finding the version of your PHP install
PDF download Download Article

If you're planning to implement new features on your website or trying to pinpoint a bug, you may need to check the version of PHP that's running on your web server. You can check the PHP version quickly by running a simple PHP file on your server, or by using the "php -v" command at the Windows, Mac, or Linux command line. This wikiHow guide will teach you the easiest ways to find out which version of PHP is running on your web server. We'll also help you fix the common 'php' is not recognized as an internal or external command error on Windows.

Quickly Check the PHP Version

To see which version of PHP is installed, open a command prompt or terminal, type "php -v", then press Enter or Return. If you can't access the command line, you can createa quick script or WordPress. If Windows doesn't recognize PHP, you'll need to add it to your system path.

Section 1 of 4:

Using the Command Line

PDF download Download Article
  1. If you have command line access on the server on which PHP is installed, you can check the PHP version using the command php -v. If the server is remote, you may need to SSH in. First, open your command line interface:
  2. When you run the command, the installed version of PHP will be displayed.
  3. Advertisement
Section 2 of 4:

Using PHP Code on Your Server

PDF download Download Article
  1. You can use Notepad, TextEdit, Vim, or any other text editor. Because you'll be creating a plain text file, it's better to use a text editor rather than a word processing program like Microsoft Word.
  2. 2
    Enter the following code. This small piece of code will return the PHP version information when it is run on your web server.[3]
    <?php
    
    // Prints e.g. 'Current PHP version: 8.3.12'
    echo 'Current PHP version: ' . phpversion();
    
    // Prints e.g. '1.22.3' or nothing if the extension isn't enabled
    echo phpversion('zip');
    
    ?>
    
  3. Call the file version.php.
  4. The file above will output your current PHP version number only. If you want more information, such as system info, build dates, available commands, and API information, you can use the phpinfo() function. Create a new text file containing the following code, and save it as info.php.
    <?php
    phpinfo();
    ?>
    
  5. If you edited the text file directly on your web server, just make sure to move the PHP file into your website's root directory. If you created the file on your computer, upload it to your web server's root web directory (often www, public_html, or htdocs). You can do this through your web host's admin control panel or an FTP client, depending on your web host.
    • If you also created an info.php file, upload that to the same location.
  6. Once you've uploaded your PHP version file, use your web browser to view 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.[4]
    • To see the full readout, visit www.yourdomain.com/info.php.
  7. 7
    Delete your PHP version script(s). Once you've checked your PHP version, delete the version.php file and the info.php file if you created one. Leaving these files in your web directory makes it easy for hackers to find out which version of PHP you're using, which could leave you open to exploitation.
  8. Advertisement


Section 3 of 4:

Checking PHP Version on WordPress

PDF download Download Article
  1. If you're using WordPress, you can check your PHP version using the built-in Site Health tool.
  2. A menu will expand.[5]
  3. You'll see this option on the menu. This takes you to the Status tab of the Site Health tool.[6]
  4. It's near the top of the Site Health tool.
  5. The currently installed version of PHP appears next to "PHP version" in the "Server" section of the tool.[7]
    • If you need to update PHP for WordPress, you can usually do so through your website's admin control panel (not through WordPress itself). If there is no option to update PHP through your control panel, your web host may need to update it for you.
  6. Advertisement
Section 4 of 4:

Fix PHP is Not Recognized in Windows

PDF download Download Article
  1. If you see the error 'php' is not recognized as an internal or external command, it's usually because PHP isn't in your Windows system path. Before you can fix the error, you'll need to determine whether PHP is installed and where it's installed. In most cases, it's installed in the root of one of your Windows drives, e.g., C:\php or D:\php.[8] Here's the best way to search:
    • Press Windows key + E to open File Explorer.
    • Click This PC in the left panel.
    • In the search box at the top-right, type php.exe and press Enter.
    • If PHP is not found, you'll need to install it. You can download the latest version as a ZIP file from windows.php.net/download/ and extract it to the C:\php or D:\php folder.
  2. 2
    Open the Advanced System Properties panel. Here's an easy way to do it:[9]
    • Press the Windows key (or click the search bar).
    • Type SystemPropertiesAdvanced (all one word).
    • Click the Control Panel. An easy way to do this is to press the Windows key, type control panel, and click Control Panel in the search results.
    • Click SystemPropertiesAdvanced or press Enter.
    • This takes you to the Advanced tab of the System Properties panel.
  3. 3
    Click the Environment Variables… button. You'll see it at the bottom of the window.[10]
  4. 4
    Select the "Path" variable under "System Variables" and click Edit. Be sure to choose the one that's in the second section, as these variables are the ones that affect the entire system.[11]
  5. 5
    Click the New button. This will allow you to enter the PHP installation path.
  6. 6
    Add the PHP install location to your path and click OK. For example, if PHP is installed in C:\php, type or paste that path into the field.
  7. 7
    Click OK and reboot. Keep clicking OK until you've closed all the windows, then perform a reboot–the reboot is needed for the change to take effect. Once your computer reboots, you should have no trouble checking the PHP version.[12]
  8. Advertisement

Community Q&A

Search
Add New Question
  • Question
    When I use the PHP -v command it says 'PHP' is not recognized as an internal or external command, operable program or batch file. Why?
    Arrogance
    Arrogance
    Top Answerer
    This is caused by PHP not being in your PATH. Follow the directions under Method 2 for setting your PATH variable.
  • Question
    `phpinfo` and `php -v` show different versions of PHP. How do you resolve this and change php -v to the desired version?
    Arrogance
    Arrogance
    Top Answerer
    `phpinfo` returns the version being used by your web server. `php -v` is the version installed in your PATH (where the operating system looks for programs to run from the command line). Check your web server setup, to find the path of the PHP interpreter it is using. Then, either invoke it by entering the full path (like C:\Programs Files\php.exe or /usr/bin/php), or add its parent directory to the top of your path variable (as described in the article. In Linux, the php command may be symlinked to a specific version, while the web server invokes another version. You'll need to modify the symlink, or run the command for your distro to select an alternative.
Ask a Question
200 characters left
Include your email address to get a message when this question is answered.
Submit
Advertisement

You Might Also Like

Check Your Java Version in the Windows Command Line Check Your Java Version in the Windows Command Line
Check Python Version on PC or Mac See the Python Version on Mac, Windows, and Linux
Install phpMyAdmin on Your Windows PCInstall phpMyAdmin on Your Windows PC
Test With PHPTest With PHP
Check Powershell VersionCheck the Powershell Version: PowerShell Commands & Registry Editions
Install Python on WindowsInstall Python on Windows
Use Windows Command Prompt to Run a Python File Use Command Prompt to Run a Python File on Windows
Write PHP ScriptsWrite PHP Scripts
Update Pip Upgrade Pip: Quick Guide for Beginners & Experts
Install WAMPInstall WAMP
Install Laravel Framework in WindowsInstall Laravel Framework in Windows
Run a PHP File in a Browser Open & Run a PHP File for Beginners
Check BIOS Version Check the BIOS Version on Windows 11, 10, and 8.1
Open a PHP FileHow Do You Open PHP Files?
Advertisement

Tips

  • The steps to update PHP vary depending on how you installed it. For example, if you installed PHP through your Linux distribution's package manager, you'll want to update PHP that way. If you installed PHP on Windows by downloading the files from PHP.net, just download the latest files, stop your web server, replace your PHP folder with the new files, and then restart your web server.
  • If you see a different PHP version when checking in your web browser than you do from the command line (and you're using the command line on your web server), this means you have two versions of PHP installed. If the command line version is more recent than the version you saw in your browser, you'll need to update your web server configuration to point to the newer version of PHP. For example, if you're using Apache, change the PHP path in httpd.conf.


Submit a Tip
All tip submissions are carefully reviewed before being published
Name
Please provide your name and last initial
Thanks for submitting a tip for review!
Advertisement

About This Article

Nicole Levine, MFA
Written by:
wikiHow Technology Writer
This article was co-authored by wikiHow staff writer, Nicole Levine, MFA. Nicole Levine is a Technology Writer and Editor for wikiHow. She has more than 20 years of experience creating technical documentation and leading support teams at major web hosting and software companies. Nicole also holds an MFA in Creative Writing from Portland State University and teaches composition, fiction-writing, and zine-making at various institutions. This article has been viewed 995,887 times.
How helpful is this?
Co-authors: 15
Updated: October 16, 2025
Views: 995,887
Categories: Web Programming
Article SummaryX

To find the version of PHP running on your web server, create and upload a script called "version.php" that contains some brief code, then access that script in your web browser.

Did this summary help you?

Thanks to all authors for creating a page that has been read 995,887 times.

Reader Success Stories

  • Anonymous

    Anonymous

    Aug 28, 2017

    "Excellent. There are plugins for this, but there is no need to run a plugin when even a non coder like me can do..." more
Share your story

Is this article up to date?

Advertisement