Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

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
add comment

3 Answers

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
add comment

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
add comment

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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.