mac如何编译安装 php7

发布时间:2021-12-16 10:33:13 作者:小新
来源:亿速云 阅读:404

这篇文章主要介绍mac如何编译安装 php7,文中介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们一定要看完!

mac编译安装php7的方法:1、通过“wget -c http://mirrors.sohu.com/php/php-7.1.8.tar.gz”下载PHP;2、通过“tar -zxvf php-7.1.8.tar.gz”解压编译即可。

本文操作环境:macOS10.15系统,PHP7.1.8版,macbook pro 2020电脑。

Mac编译安装PHP7.1.8:

1、下载稳定版本的PHP
wget -c http://mirrors.sohu.com/php/php-7.1.8.tar.gz
2、解压编译
tar -zxvf php-7.1.8.tar.gz

./configure --prefix=/usr/local/php/7.1.8 \
--with-config-file-path=/usr/local/php/7.1.8/etc \
--with-config-file-scan-dir=/usr/local/php/7.1.8/etc/conf.d \
--with-apxs2=/usr/sbin/apxs \
--enable-fpm \
--with-fpm-user=www \
--with-fpm-group=www \
--with-mysqli \
--with-pdo-mysql \
--with-iconv-dir \
--with-freetype-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-openssl \
--with-mhash \
--enable-pcntl \
--enable-sockets \
--with-xmlrpc \
--enable-zip \
--enable-soap \
--without-pear \
--with-gettext \
--disable-fileinfo \
--enable-maintainer-zts \
--enable-mysqlnd
遇到的问题:
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)

解决方案:查找httpd安装目录下的bin目录里的 apxs ,尽量不要写/usr/bin/apxs

configure: error: OpenSSL version 1.0.1 or greater required.

解决方案:由于Mac自带的openssl没法升级(我没找到升级的办法),用

brew install openssl

安装最新版的openssl,然后在参数中加上brew安装的ssl的路径

--with-openssl=/usr/local/Cellar/openssl@1.1/1.1.0e
configure: error: Cannot locate header file libintl.h

解决方案:

brew install gettext

打开PHP的 configure文件,修改文件的

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

改成

for i in $PHP_GETTEXT /usr/local /usr/ usr/local/opt/gettext;do
checking for iconv... no
checking for libiconv... no
configure: error: Please specify the install prefix of iconv with --with-iconv=<DIR>

解决方案:
安装 libiconv (字符编码转换库)
网站地址: http://www.gnu.org/software/libiconv/
当前版本: https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.15.tar.gz

$ wget [https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.15.tar.gz
$ tar zxvf libiconv-1.15.tar.gz
$ cd libiconv-1.15
$ ./configure --prefix=/usr/local/lib/libiconv
$ make
$ sudo make install

安装

make && sudo make install

以上是“mac如何编译安装 php7”这篇文章的所有内容,感谢各位的阅读!希望分享的内容对大家有帮助,更多相关知识,欢迎关注亿速云行业资讯频道!

推荐阅读:
  1. lamp编译安装+discuz+禅道
  2. phpredis -- Redis编译安装,PHP 7 安装 Redis 扩展

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

mac php7

上一篇:yum如何安装php7 扩展

下一篇:Linux sftp命令的用法是怎样的

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》