命令行和 apache 中的不同版本 php [英] different version php on command line and in apache

查看:35
本文介绍了命令行和 apache 中的不同版本 php的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是 mac 10.8,我已经安装了 php 5.5.在命令行 php -v 显示版本 5.5.但是当我使用 phpinfo() 启动 mac 的 apache 服务器时,它显示版本 5.4.

I am using mac 10.8 and I have installed php 5.5. At command line php -v show version 5.5. but when I starts mac's apache server with phpinfo(), it show version 5.4.

谁能帮助我如何让 apache 使用 5.5 版

Can anyone please help me how to make apache to use version 5.5

谢谢

推荐答案

  1. 找出conf/httpd.conf和conf.d/*.conf

  1. find out the conf/httpd.conf and conf.d/*.conf

找到这样的标签:LoadModule php5_module modules/libphp5.so

find the tag like this: LoadModule php5_module modules/libphp5.so

更改为正确的 php 安装文件夹,如下所示:LoadModule php5_module/usr/local/Cellar/php54/5.4.8/libexec/apache2/libphp5.so

make the change to correct php installation folder like this: LoadModule php5_module /usr/local/Cellar/php54/5.4.8/libexec/apache2/libphp5.so

这将改变你在 Apache 中的 php 模型(php 版本)

This will change your php model (php version) in Apache

在本地桌面搜索:find/-name "libphp5.so"

Search on your local desk: find / -name "libphp5.so"

关于正确的so文件:编译后未创建libphp5.so,未创建前缀目录

[更新]

http://www.howtoforge.com/centos-5.6-php53-common-conflicts-with-php-common

1) 更新 yum 以包含最新的 php

1) update yum to include latest php

2)对于 64 位系统,您可以在此处找到正确的软件包:http:///dl.iuscommunity.org/pub/ius/stable/Redhat/5/x86_64/

2) For 64bit systems, you can find the correct packages here: http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/x86_64/

对于 32 位系统,正确的软件包在这里:http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/i386/

For 32bit systems, the correct packages are here: http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/i386/

3)(替换为您想要的正确 URL 和文件名,从步骤2)"检查)

3) (replace to the correct URL and file name which you want to have, check it from step "2)")

rpm -Uvh http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/i386/epel-release-5-4.noarch.rpm

rpm -Uvh http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/i386/ius-release-1.0-11.ius.el5.noarch.rpm

4) rpm --import/etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL

4) rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL

rpm --import/etc/pki/rpm-gpg/IUS-COMMUNITY-GPG-KEY

rpm --import /etc/pki/rpm-gpg/IUS-COMMUNITY-GPG-KEY

5) yum install yum-plugin-replace

5) yum install yum-plugin-replace

6)您现在可以用 IUS 的 PHP 新版本包替换旧版本的 PHP 包,如下所示:

6) You can now replace your PHP old version packages with the PHP new version packages from IUS like this:

yum 替换 php --replace-with php55w

yum replace php --replace-with php55w

您可以像这样搜索更多的 php55w 包:

You can search for further php55w packages like this:

百胜搜索php53u

这篇关于命令行和 apache 中的不同版本 php的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆