Checking what PHP version I'm running on Linux?
I'm running Centos 5 and I need to know what version of PHP I'm running, is there a command for this which I can run?
4 Answers
Try running the following at the command line.
To just get the version information:
php -vOr to get a lot of info:
php -iIt should give you all information you need about the php install.
5You can make an index.php file with
<?php phpinfo() ?> 5 An answer was accepted, but another option on RPM systems (RHEL, Centos, Fedora, etc.) is to use the following:
rpm -q phpAnd while I'm at it, the general method for using RPM to find info on a package for any rpm-installed program or file is similar to this (for awk):
Find the full path to the file if not known, such as for an executable in $PATH:
type -path awk
Find the name, including version, of the package containing the file:
rpm -qf /usr/bin/awk
If desired, query for info from that package:
rpm -qi gawk
It's a bit trickier for packages installed and used by Apache since they may not be on $PATH, but you can start with something like:
rpm -qa | egrep -i 'php|awk'
Use
more /etc/php.iniThis will show you:
- Apache Version
- PHP Versions
- PHP Functions
- Various options regarding PHP