简体   繁体   English

升级到5.4,但“php -v”仍然返回旧版本

[英]Upgraded to 5.4 but “php -v” still returns older version

I'm on OSX Lion 10.7.5. 我在OSX Lion 10.7.5上。 As advised at How do I upgrade PHP in Mac OS X? 如何在Mac OS X中升级PHP? , I used: , 我用了:

curl -s http://php-osx.liip.ch/install.sh | bash -s 5.4

Everything appeared to go well, no errors, I'm on a 64bit system, etc., but when I run "php -v" I still see the same version I had before (5.3.15). 一切似乎进展顺利,没有错误,我在64位系统等,但当我运行“php -v”时,我仍然看到我之前的版本(5.3.15)。 On a scale of 1-10 I'm probably a 2 when it comes to installing stuff via the command line, so, please factor that into any responses. 在1-10的范围内,当通过命令行安装东西时,我可能是2,因此,请将其纳入任何响应中。

UPDATE: I took a closer look at the Terminal output after running curl -s http://php-osx.liip.ch/install.sh | bash -s 5.4 更新:运行curl -s http://php-osx.liip.ch/install.sh | bash -s 5.4后,我仔细查看了终端输出curl -s http://php-osx.liip.ch/install.sh | bash -s 5.4 curl -s http://php-osx.liip.ch/install.sh | bash -s 5.4 and I noticed the following: curl -s http://php-osx.liip.ch/install.sh | bash -s 5.4我注意到以下内容:

Installing package tools-memcached into root /
./pkg/pre-install
pkg/pre-install
Skipping existing directory 
Skipping existing directory usr/
Skipping existing directory usr/local/

...then at the end of the installation: ......然后在安装结束时:

Create symlink /usr/local/php5/entropy-php.conf /etc/apache2/other/+php-osx.conf
Removed /usr/lib from DYLD_LIBRARY_PATH in /usr/sbin/envvars
Restarting Apache
httpd: Could not reliably determine the server's fully qualified domain name

Can anybody elaborate on precisely what that means? 任何人都能详细说明这意味着什么吗? As explained in the comments, it seems I've got the files installed, but, I'm having trouble resolving what appears to be a $PATH issue. 正如评论中所解释的那样,我似乎已经安装了文件,但是,我无法解决看起来像$ PATH问题的问题。

创建一个指向新php安装路径的sym链接,如下所示:

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

If you use Apache first disable current php module 如果你使用Apache首先禁用当前的php模块

sudo a2dismod php5 sudo a2dismod php5
sudo a2dismod php5.6 sudo a2dismod php5.6

then enable 然后启用

sudo a2enmod php7.0 sudo a2enmod php7.0

and restart apache 并重新启动apache

sudo service apache2 restart sudo service apache2 restart

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM