Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
292 views
in Technique[技术] by (71.8m points)

macos - How to use the php that brew installed?

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. check whether there is a difference between the php installed by brew and the php which Apache uses?
  2. make apache use the php that brew installed?

All tips are welcome!

Question&Answers:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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

  • 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

  • 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

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

    sudo apachectl restart


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...