php Version Check
How to Check if php is installed on the Web Server
and how to Detect
the php Version using phpinfo()
php is installed on most hosted Linux based web servers, but it's also available for Windows based web servers.
Check if php is installed on your Web Server
1. Create a text file, e.g. using notepad or any other text editor:
<?php
phpinfo();
?>
2. Save the file as "version.php". Make sure, that the extension is .php (not .txt)
3. Upload the file to the root of your web
4. Open the file in your web browser, e.g. http://www.yourdomain.tld/version.php
5. Delete the file on your web server after you are done. You should be the only one seeing this information!
How to detect the php Version?
Run the phpinfo() script above.
It contains much more information,
like:
- php Version
- Build Date
- Configuration
- ...
- Installed php Modules
- php Variables
Multiple php Versions on the same Server
Some web server are pre-configured to run e.g. php5 and php8 at the same
time, to ensure compatibility with older scripts and CMS systems.
If
you web server is configured for multiple php versions, select the php version
by using e.g.
somescript.php5 // for php5 (old) scripts
somescript.php8 // for php8 scripts
somescript.php // for the default
php version
The default php version depends either on your php configuration or on your hosting package.