Mac中如何安装PHP7,为什么brew 安装php7为什么找不到.so文件呢,安装php7后丢失libphp7.so了吗 。那安装 brew install php72 时怎么配置参数呢

常见问题 找不到libphp7.so

首先系统中brew 1.4.0版本

➜  apache2 git:(stable) ✗ brew -v

Homebrew 1.4.0

Homebrew/homebrew-core (git revision 7990; last commit 2017-12-14)

➜  apache2 git:(stable) ✗

查看php72有哪些options选项可以安装,那其中--with-httpd看到没,这个就是libphp7.so文件的关键参数,其他参数根据需要自行选择。

➜  apache2 git:(stable) ✗ brew options php72    

............

 此处省略无数字

.............

--with-httpd

Enable building of shared Apache Handler module

............

 此处省略无数字

.............

--HEAD

Install HEAD version

那这里根据开发需要我选择了自己需要的参数,命令如下,要先解绑之前的PHP版本,如下执行过程:

➜  apache2 git:(stable) ✗ brew install php72  --with-httpd --with-debug   --with-imap --with-mssql --with-pear --with-postgresql   --with-webp


安装执行过程中摘要可用信息:

#PHP72配置文件所在位置

/usr/local/etc/php/7.2/php.ini  


#apache引入libphp7.so文件

To enable PHP in Apache add the following to httpd.conf and restart Apache:

LoadModule php7_module /usr/local/opt/php72/libexec/apache2/libphp7.so #

#此处顾名思义,系统自带了Apache module ,

#你想build一个那就需要增加参数--with-httpd,想看其他参数细节执行brew options php72

With the release of macOS Sierra the Apache module is now not built by default.

 you want to build it on your system you have to install php with the --with-httpd option. See  brew options php72 for more details.


到此安装步骤完成,libphp7.so在目录/usr/local/Cellar/php72/7.2.0_11/libexec/apache2/libphp7.so下,具体使用请在apache配置文件httpd.conf中引入切换。

另外之前有版本的参数是--with--apache,旧版本在这里不予赘述。


本文安装详细过程信息可移驾至 我的简书


本文链接二维码可以保存在本地:保存

| 浏览 (8089) | (0) | (0) | | 2017-12-14 20:01:13 |


相关文章

  1. Mac 终端查看外网IP
  2. 用古诗吵架的小两口
  3. Mac下brew卸载php7重新安装php7
  4. Mac yld: Library not loaded: /usr/local/opt/jpeg/lib/libjpeg.8.dylib
  5. Mac brew安装多个版本PHP
  6. Mac brew Error: Cannot tap homebrew/php: invalid syntax in tap!