mac安装PHP7时出现的问题汇总-PHP7

资源魔 27 0

布景

头几天正在mac上跑workrman,因为workerman需求开启多个过程,多过程需求pcntl扩大的支持,我以前阿谁brew装置的php71不这个扩大,就间接卸载了php71,而后想下载源码编译装置php7的更高版本,也能够更自在的装置扩大。

源码编译装置(php-7.2.7)

成绩一

configure: WARNING: you should use --build, --host, --target
configure: WARNING: invalid host type:
configure: WARNING: you should use --build, --host, --target
configure: WARNING: invalid host type:  --enable-fpm
configure: WARNING: you should use --build, --host, --target
configure: WARNING: invalid host type:  --with-mysqli
configure: WARNING: you should use --build, --host, --target
configure: WARNING: invalid host type:  --with-pdo-mysql
configure: WARNING: you should use --build, --host, --target
configure: WARNING: invalid host type:  --with-iconv-dir
configure: WARNING: you should use --build, --host, --target
configure: WARNING: invalid host type:  --with-eeeetype-dir
configure: WARNING: you should use --build, --host, --target
configure: WARNING: invalid host type:  --with-zlib
configure: WARNING: you should use --build, --host, --target
configure: WARNING: invalid host type:  --with-jpeg-dir
configure: WARNING: you should use --build, --host, --target
configure: WARNING: invalid host type:  --with-png-dir
configure: error: invalid variable name: ` --with-libxml-dir'

处理:都是由于—with后面多了个空格

成绩二

Sorry, I cannot run apxs. Possible reasons follow:
1. Perl is not installed
2. apxs was not found. Try to pass the path using --with-apxs2=/path/to/apxs
3. Apache was not built using --enable-so (the apxs usage page is displayed)

处理方法

brew install httpd
find / -name apxs 
Centos下执行 yum install -y httpd-devel

查找到apxs文件门路,而后修正编译参数以下

--with-apxs2=/usr/local/bin/apxs

成绩三

checking if the location of ZLIB install directory is defined... no ;
configure: error: Cannot find libz.

处理方法

brew install zlib
find / -name lib

加之参数

--with-zlib-dir=/usr/local/Cellar/zlib/1.2.11

成绩四

configure: error: Cannot locate header file libintl.h

缘由是不gettext

处理方法:

$PHP_GETTEXT /usr/local /usr; do

configure文件改成

for i in $PHP_GETTEXT /usr/local /usr /usr/local/opt/gettext; do

成绩五

configure: error: Please specify the install prefix of iconv with --with-iconv=<DIR>

处理方法,编译参数中加之

\--with-iconv=/usr/local/Cellar/libiconv/1.15

成绩六

checking for libiconv in -liconv... no
checking for iconv in -liconv... no
configure: error: Please reinstall the iconv library.

【终极卡正在了这里,没处理。而后编译装置就不胜利】

最初处理到成绩五的时分的编译装置饬令以下:

./configure --prefix=/usr/local/php/7.2.7\—with-config-file-path=/usr/local/php/7.2.7/etc \--with-config-file-scan-dir=/usr/local/php/7.2.7/etc/conf.d  \--with-apxs2=/usr/local/bin/apxs \--with-zlib-dir=/usr/local/Cellar/zlib/1.2.11 \--enable-fpm \--with-fpm-user=www \--with-fpm-group=www \--with-mysqli \--with-pdo-mysql  \--with-iconv=/usr/local/Cellar/libiconv/1.15 \--with-eeeetype-dir \--with-zlib \--with-jpeg-dir \--with-png-dir \--with-libxml-dir=/usr/bin/xml2-config \--enable-xml \--disable-rpath \--enable-bcmath \--enable-shmop \--enable-sysvsem \--enable-inline-optimization \--with-curl \--enable-mbregex \--enable-mbstring \--with-mcrypt \--enable-ftp \--with-gd \--enable-gd-native-ttf \--with-onsnssl \--with-mhash \--enable-pcntl \--enable-sockets \--with-xmlrpc \--enable-zip \--enable-soap \--without-pear \--with-gettext \--disable-fileinfo \--enable-maintnener-zts \--enable-mysqlnd

brew装置

1.搜寻brew中的php

brew search php

呈现了:php@5.6 php@7.1 php@7.0

2.而后装置了php7.0

brew install php70

3.将php设置零碎环境变量

find / -name php # 先找到php执行文件
cp /usr/local/Cellar/php@7.0/7.0.30_1/bin/php /usr/bin  # 将php执行文件放到/usr/bin/文件夹中

最初

经过源码编译装置不胜利,仍是brew install装置胜利。

更多PHP7相干常识,请拜访PHP7专题栏目!

以上就是mac装置PHP7时呈现的成绩汇总的具体内容,更多请存眷资源魔其它相干文章!

标签: PHP7 php7开发教程 php7开发资料 php7开发自学

抱歉,评论功能暂时关闭!