网创优客建站品牌官网
为成都网站建设公司企业提供高品质网站建设
热线:028-86922220
成都专业网站建设公司

定制建站费用3500元

符合中小企业对网站设计、功能常规化式的企业展示型网站建设

成都品牌网站建设

品牌网站建设费用6000元

本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...

成都商城网站建设

商城网站建设费用8000元

商城网站建设因基本功能的需求不同费用上面也有很大的差别...

成都微信网站建设

手机微信网站建站3000元

手机微信网站开发、微信官网、微信商城网站...

建站知识

当前位置:首页 > 建站知识

mac安装PHP7时出现的问题有哪些-创新互联

这篇文章主要介绍mac安装PHP7时出现的问题有哪些,文中介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们一定要看完!

成都创新互联,为您提供网站建设成都网站制作、网站营销推广、网站开发设计,对服务护栏打桩机等多个行业拥有丰富的网站建设及推广经验。成都创新互联网站建设公司成立于2013年,提供专业网站制作报价服务,我们深知市场的竞争激烈,认真对待每位客户,为客户提供赏心悦目的作品。 与客户共同发展进步,是我们永远的责任!

背景

前几天在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=

解决办法,编译参数中加上

\--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安装成功。

以上是mac安装PHP7时出现的问题有哪些的所有内容,感谢各位的阅读!希望分享的内容对大家有帮助,更多相关知识,欢迎关注创新互联网站制作公司行业资讯频道!


当前名称:mac安装PHP7时出现的问题有哪些-创新互联
文章链接:http://bjjierui.cn/article/dggeps.html

其他资讯