Take the 2-minute tour ×

I have having a helluva time trying to track down which php binary my apache is using.

locate bin/php returns this list


Let's see the versions:

/usr/bin/php -v       shows 5.3.2
/usr/bin/local/php -v shows 5.3.2

What about which?

[macek ~]$ which php

The problem

phpinfo(); when executed by apache shows 5.2.11

Where is this phantom 5.2.11 on my system?

share|improve this question
Did you solve this issue? –  Daniel Beck Jun 3 '11 at 18:06
@Daniel Beck, yes, see the solution below. Apache is loading php as a module. Replace this module with an updated one and you should be all set :) –  macek Jun 4 '11 at 14:45

3 Answers 3

up vote 2 down vote accepted

Are you using PHP through CGI? Or did you build it into Apache at runtime as mod_php? If you're not running PHP as a CGI program, it doesn't matter where it is in the shell.

share|improve this answer
Ah! I'm pretty sure it's loading as LoadModule php5_module libexec/apache2/libphp5.so –  macek May 3 '10 at 19:15

Check and make sure your apache install isn't loading mod_php from two different places. In a lot of modern linux distributions, Mod_php is included under /etc/http/conf.d/php.conf, and not (as used to be the case) in the regular /etc/httpd/conf/httpd.conf file.

I've seen people accidentally tell apache to load php twice, not knowing that. It's especially common if you build your own version of php, and update the httpd.conf file yourself, without checking to make sure there isn't a php.conf file.

share|improve this answer

To be sure, you can see what's actually running in your apache.

Two ways I know of:

The lsof command lists open files, and you can specify a process ID, and it will show the files open (including shared libs) for that process.

Once opened, shared libs are mapped into memory. On Linux you can look in the /proc/pid/maps file to see all shared libs mapped for your process.

share|improve this answer

Your Answer


