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 your webs server. You can also check what version is installed on your local computer using the Command Prompt or Terminal.
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.
Open a text or code editor.You can use Notepad or TextEdit. Don't use a word processor such as Microsoft Word.
Enter the following code.This small piece of code will return the PHP version information when it is run on your web server.<?php 'Current PHP version: 'phpversion
Save the file as a PHP file.Click "File" → "Save as" and then give the file a name. Add the.phpextension to the end of the file name. Name it something simple, likeversion.php.
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 thephpinfo()command. Save the file asinfo.php.<?php phpinfo
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.
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 visitwww.yourdomain.com/version.php.
- To see the full readout, visitwww.yourdomain.com/info.php.
Local 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.
- Windows - PressWin+Rand typecmd.
- Mac - Open Terminal from the Utilities folder.
- Linux - Open Terminal from the dash, or by pressingCtrl+Alt+T.
Enter the command to check the PHP version.When you run the command, the installed version of PHP will be displayed.
- Windows, Mac, Linux -php -v
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.
- Find the location of yourphp.exefile. This is usuallyC:\php\php.exe, but you may have changed this during installation.
- Typeset PATH=%PATH%;C:\php\php.exeand pressEnter. Change the actual location if yours is different.
- Runphp -vagain. You should now be able to see the version number.
Sources and Citations
In other languages:
Español: , Italiano: , Русский: , Português: , Deutsch: , Français: , Bahasa Indonesia: , Nederlands: , ไทย: , 中文: , Tiếng Việt: , العربية: , 日本語: , 한국어: , हिन्दी:
About This Article
Aug 28, 2019
Shalini Shalu Sharma
Aug 17, 2019
Jun 12, 2019
Aug 13, 2019
Oct 13, 2019
Aug 13, 2019
Nov 8, 2019
Video: how to check PHP version
How to Keep a Low Phenylalanine Diet with Phenylketonuria (PKU)
Berry Iced Yogurt Recipe
Richard Branson’s 1972 Diary Reveals One Of The Billionaire’s Top Tips For Success
Colored Jeans Guide: How to Wear Every Color of Denim
Jeff Koonss Inspirations
Hillary Clinton Uses The Handmaids Tale to Make a Point About Womens Rights
Iced Lemons with Raspberries and Mint
Is Your Water Fit to Drink
You Should Actually Be Pretty Worried About The Equifax Data Breach
Christian Louboutin Introduces Loubichrome Unicorn Nail Polishes
Psoriasin Advanced Treatment