osx 编译安装php,Mac OSX编译安装php7.1.8

"本文介绍了在Laravel项目中使用LDAP认证时遇到的PHP版本要求,以及安装MewsCaptcha包时的验证码显示问题。详细讲述了如何重新编译PHP 7.1.7,解决apxs报错、openssl版本升级、libldap库链接等问题,并附上编译步骤和常见错误排查方法。"
摘要由CSDN通过智能技术生成

laravel中用到ldap认证包,要求php7.0以上版本,而且安装Mews\Captcha包的时候 验证码无法显示

9861b34ecea3e3a5734dcdf1406af7a6.png

报错如下:

Call to undefined function Intervention\Image\Gd\imagettfbbox()

搜索发现需要重新编译php,添加 --with-jpeg-dir=DIR

1.下载源码  http://mirrors.sohu.com/php

wget -c http://mirrors.sohu.com/php/php-7.1.7.tar.gz

tar -zxvf php-7.1.7.tar.gz

cd php-7.1.7

./configure --prefix=/usr/local/php7.1.7 \

--with-config-file-path=/usr/local/php7.1.7/etc \

--with-config-file-scan-dir=/usr/local/php7.1.7/etc/conf.d \

--with-apxs2=/usr/local/bin/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=/usr/local/Cellar/openssl/1.0.2o_1 \

--with-mhash \

--enable-pcntl \

--with-ldap \

--enable-sockets \

编译的过程遇到的问题

1.apxs报错的问题

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

解决办法

brewinstallhttpd,然后find / -name apxs

Centos下执行 yum install -y httpd-devel

查找到apxs文件路径,然后修改编译参数如下--with-apxs2=/usr/local/bin/apxs

2.configure: error: OpenSSL version 1.0.1or greater required.

解决办法:

brew upgrade openssl

然后修改编译参数为 openssl的实际路径--with-openssl=/usr/local/Cellar/openssl/1.0.2o_1

上述路径根据自己的环境灵活修改

Centos下 需要 yum install openssl openssl-devel

然后ln -s /usr/lib64/lib

configure: error: Cannot find ldap libraries in /usr/lib

解决办法:cp -frp /usr/lib64/libldap* /usr/lib/然后再./configure ...即可

报错信息/usr/bin/ld: ext/ldap/.libs/ldap.o: undefined reference to symbol 'ber_scanf'

/usr/lib64/liblber-2.4.so.2: error adding symbols: DSO missing from command line

collect2: error:ld returned 1exit statusmake: *** [sapi/cli/php] 错误 1解决办法:

./configure后

编辑MakeFile

找到 开头是'EXTRA_LIBS' 这一行 在结尾加上 '-llber' 然后执行 make && make install

参考地址:

https://www.jianshu.com/p/dff29b4566a6

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值