The Computer Oracle

Checking what PHP version I'm running on Linux?

Become or hire the top 3% of the developers on Toptal https://topt.al/25cXVn

--

Music by Eric Matyas
https://www.soundimage.org
Track title: The World Wide Mind

--

Chapters
00:00 Question
00:21 Accepted answer (Score 184)
00:45 Answer 2 (Score 19)
00:59 Answer 3 (Score 12)
02:20 Answer 4 (Score 3)
02:43 Thank you

--

Full question
https://superuser.com/questions/28633/ch...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#linux #centos #php

#avk47



ACCEPTED ANSWER

Score 184


Try running the following at the command line.

To just get the version information:

php -v

Or to get a lot of info:

php -i

It should give you all information you need about the php install.




ANSWER 2

Score 19


You can make an index.php file with

<?php phpinfo() ?>



ANSWER 3

Score 12


An answer was accepted, but another option on RPM systems (RHEL, Centos, Fedora, etc.) is to use the following:

rpm -q php

And 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):

  1. Find the full path to the file if not known, such as for an executable in $PATH:

    type -path awk

  2. Find the name, including version, of the package containing the file:

    rpm -qf /usr/bin/awk

  3. 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'




ANSWER 4

Score 3


Use

more /etc/php.ini

This will show you:

  1. Apache Version
  2. PHP Versions
  3. PHP Functions
  4. Various options regarding PHP