OSX Apache 使用错误版本的 PHP [英] OSX Apache using wrong version of PHP

查看:30
本文介绍了OSX Apache 使用错误版本的 PHP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我按照指南使用 home-brew 在 OSX Mountain Lion 上安装了最新版本的 php (5.4.8).

I followed a guide which used home-brew to install the lastest version of php (5.4.8) on OSX Mountain Lion.

然后我遵循了一个指南,该指南向我展示了如何在 OSX 上设置和使用预安装的 apache.

I then followed a guide which showed me how to setup and use the pre-installed apache on OSX.

然而,当我尝试运行一个基本的 Symfony 2 项目时,我收到了一堆与 php.ini 中缺少 date.timezone 相关的错误.

However when I try running up a base Symfony 2 project I get a bunch of errors relating to missing date.timezone in the php.ini.

然而,我正确设置了 php.ini,但在 Symfony 项目中快速执行 phpinfo() 表明它使用旧的预装版本 php (5.3) 而不是新版本.

However I have this correctly setup the php.ini but doing a quick phpinfo() in the Symfony project shows that its using the old preinstalled version of php (5.3) rather than the new one.

在终端中,如果我输入 which php &php -v,它显示正在使用正确的新版本.

In terminal if I type which php & php -v, It shows the correct new version is being used.

但是 phpinfo() 显示

推荐答案

您是否遵循了警告中提供的所有说明?

Did you follow all the instructions provided in the Caveats?

运行 brew info php54 再次查看它们.

Run brew info php54 to see them again.

尤其是那一行:

要在 Apache 中启用 PHP,请将以下内容添加到 httpd.conf 并重启 Apache:
LoadModule php5_module/usr/local/Cellar/php54/5.4.8/libexec/apache2/libphp5.so

To enable PHP in Apache add the following to httpd.conf and restart Apache:
LoadModule php5_module /usr/local/Cellar/php54/5.4.8/libexec/apache2/libphp5.so

这篇关于OSX Apache 使用错误版本的 PHP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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