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

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

问题描述

我使用的是Mac 10.8和我已经安装了PHP 5.5。在命令行运行php -v显示版本5.5。但是当我开始Mac的Apache服务器与phpinfo()函数,它显示出5.4版本。

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

感谢


解决方案

  1. 找出的conf / httpd.conf文件和conf.d / *。CONF


  2. 找到这样的标签:的LoadModule php5_module模块/ libphp5.so


  3. 进行更改,纠正这样的PHP的安装文件夹:
    的LoadModule php5_module /usr/local/Cellar/php54/5.4.8/libexec/apache2/libphp5.so


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

在本地搜索的办公桌:查找/ -namelibphp5.so

关于正确使文件:<一href=\"http://stackoverflow.com/questions/4977152/libphp5-so-not-being-created-after-compiling-and-$p$pfix-directory-not-created\">libphp5.so没有被编译和preFIX目录未

创建后创建

[更新]

<一个href=\"http://www.howtoforge.com/centos-5.6-php53-common-conflicts-with-php-common\">http://www.howtoforge.com/centos-5.6-php53-common-conflicts-with-php-common

1)更新百胜,包括最新的PHP

2)
对于64位系统,你可以在这里找到正确的包:<一href=\"http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/x86_64/\">http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/x86_64/

有关32位系统,正确的包在这里:<一href=\"http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/i386/\">http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/i386/

3)
(替换到你想有正确的URL和文件名,从步骤检查2))

RPM -Uvh <一个href=\"http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/i386/epel-release-5-4.noarch.rpm\">http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/i386/epel-release-5-4.noarch.rpm

RPM -Uvh <一个href=\"http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/i386/ius-release-1.0-11.ius.el5.noarch.rpm\">http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/i386/ius-release-1.0-11.ius.el5.noarch.rpm

4)转--import的/ etc / PKI / RPM-GPG / RPM-GPG-KEY-EPEL

转--import的/ etc / PKI / RPM-GPG / IUS共同体GPG-KEY

5)百胜安装yum-插件替换

6)
现在,您可以从IUS PHP的新版本的软件包像这样替换你的PHP旧版本的软件包:

百胜取代PHP --replace-与php55w

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

百胜搜索php53u

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.

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

Thanks

解决方案

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

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

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

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

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

Regarding the correct so file: libphp5.so not being created after compiling and prefix directory not created

[update]

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

1) update yum to include latest php

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

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

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

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

5) yum install yum-plugin-replace

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

yum replace php --replace-with php55w

You can search for further php55w packages like this:

yum search php53u

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

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