views:

54

answers:

1

Need to downgrade php to 5.2.x, so I followed this tutorial: http://andreys.info/blog/2010-03-25/compile-php-5-2-on-osx-10-6-snow-leopard#comment-631

I'm on snow leopard 10.6.4, with xcode installed.

So I compiled php5.2.x and completed the tutorial. phpinfo() loaded within the browser at htp://localhost says 5.2.x, Great!! But, Terminal command "php --version" says 5.3.x ??

While compiling/installing php5.2.x, the new module file replaced the php5.3.x module here: /usr/libexec/apache2/libphp5.so

  1. So where is Terminal getting 5.3.x from?
  2. Do I have two php versions being loaded?
  3. Should I even care?
+2  A: 
  1. Check using which php. This should tell you which is being used.
  2. Yes, looks like you have two installed at different locations.
  3. Yes, mind what's being used where. Having multiple versions is absolutely valid (at least on a development or testing system) but you always should be aware of the versions being used.
johannes
Ok running 'which php' in terminal gives: /usr/bin/php. The php that i compiled, 5.2.x, seems to be here: /usr/local/php5/bin. How come when loading php from localhost in browser uses 5.2.x but terminal php command uses 5.3.x? I just want to have one running at a time. What to do?
HArcher
The version in the browser is absolutely independent. Check your server configuration ... like /etc/apache/httpd.conf or such which most likely loads a /usr/local/php5/lib/libphp5.so or such.
johannes
LoadModule php5_module libexec/apache2/libphp5.so. However, this file libphp5.so is the compiled file for 5.2.x! It's no longer the 5.3.x version that came with osx. So why it Terminal showing 5.3.x? I'm spending too much time on this and really don't want to resort to MAMP...Thanks for your help btw
HArcher
You have one file libexec/apache2/libphp5.so containing one version. You also have /usr/bin/php, which is a different file containing a different version. And you have /usr/local/php5/bin/php which is yet another file. Each of these files contains the complete PHP. One time with an interface for talking to apache, the other ones for talking to the command line.
johannes
This makes sense. I did this in terminal: $ /usr/local/php5/bin/php --version...This shows the correct php install and version.
HArcher