如何使用brew安装的php? [英] How to use the php that brew installed?

查看:46
本文介绍了如何使用brew安装的php?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的 Mac 上,我安装了 php 并且运行良好.我最近想安装 mcrypt,所以我使用 brew 安装.虽然它似乎安装得很好,但它没有出现在我的 phpinfo() 中.所以我认为brew安装mcrypt的php不是apache使用的php.

On my mac I've got php installed and working fine. I recently wanted to install mcrypt, so I did so using brew. Although it seemed to install fine, it doesn't show up in my phpinfo(). So I think that the php that brew installed mcrypt in, isn't the php that apache uses.

有人知道我该怎么做吗:

Does anybody know how I can:

  1. 检查brew安装的php和Apache使用的php有没有区别?
  2. 让 apache 使用 brew 安装的 php?

欢迎所有提示!

推荐答案

你必须让你的 Apache 使用你刚下载的 PHP.

You have to make your Apache use the PHP that you just downloaded.

  • 打开你的 httpd.conf(我的在 /etc/apache2/httpd.conf)并寻找加载 PHP 模块的那一行喜欢:

  • Open your httpd.conf (mine is at /etc/apache2/httpd.conf) and look for the line that loads the PHP module, something like:

LoadModule php5_module path/to/php

然后,将其指向为您安装的 brew 支持 mcrypt 的 PHP.我的是在这条路上.您的设置可能因您安装的 PHP 版本而异.

Then, make it point to the PHP that brew installed for you with mcrypt support. Mine was at this path. Yours can vary depending on the PHP version that you installed.

/usr/local/Cellar/php54/5.4.21/libexec/apache2/libphp5.so

最后,您需要重新启动 Apache 服务器以加载新配置:

Finally you will need to restart your Apache server to load the new configuration:

sudo apachectl restart

这篇关于如何使用brew安装的php?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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