Trying to find a duplicate version of PHP on my system. Where is it?

0

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

locate bin/php returns this list

/usr/bin/php
/usr/bin/php-cgi
/usr/bin/php-config
/usr/bin/phpize
/usr/local/bin/php
/usr/local/bin/php-cgi
/usr/local/bin/php-config
/usr/local/bin/php-shell.sh
/usr/local/bin/phpize

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
/usr/bin/php

The problem

phpinfo(); when executed by apache shows 5.2.11

Where is this phantom 5.2.11 on my system?

macek

Posted 2010-05-03T19:03:16.750

Reputation: 5 157

Did you solve this issue? – Daniel Beck – 2011-06-03T18:06:48.477

@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 – 2011-06-04T14:45:38.343

Answers

2

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.

Andy Lester

Posted 2010-05-03T19:03:16.750

Reputation: 1 121

Ah! I'm pretty sure it's loading as LoadModule php5_module libexec/apache2/libphp5.so – macek – 2010-05-03T19:15:34.680

1

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.

Satanicpuppy

Posted 2010-05-03T19:03:16.750

Reputation: 6 169

0

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.

Rich Homolka

Posted 2010-05-03T19:03:16.750

Reputation: 27 121