Terminal displays wrong php version (Snow Leopard)

点点圈 提交于 2019-12-21 15:33:33

问题


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?

回答1:


  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.



回答2:


For a more direct solution to the problem:

  1. Rename the OLD version of PHP

    sudo mv /usr/bin/php /usr/bin/php5424

  2. Create a Symbolic link for your new version of php so it can live in /usr/bin

    sudo ln -s /usr/local/php5/bin/php /usr/bin/php



来源:https://stackoverflow.com/questions/3973271/terminal-displays-wrong-php-version-snow-leopard

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!