1

官网下载php5.6

依次在目录中执行:

./buildconf --force

./configure --prefix=/data/php-fpm --with-apxs2=/usr/sbin/apxs --enable-fpm --with-fpm-user=myname --with-fpm-group=myname --with-mysqli --with-pdo-mysql --with-iconv-dir --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --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

遇到报错:

configure: error: Cannot find OpenSSL's <evp.h>

半年之后,又遇到了openssl的问题,看来要短兵相接了!

N久之前,安装了这个openssl-1.0.1q

修改configure

./configure --prefix=/data/php-fpm --with-apxs2=/usr/sbin/apxs --enable-fpm --with-fpm-user=myname --with-fpm-group=myname --with-mysqli --with-pdo-mysql --with-iconv-dir --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --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=/data/openssl-1.0.1q --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --disable-fileinfo --enable-maintainer-zts

还是同样的报错

只好百度一下了。

参考这个:Link

尝试

brew install openssl

发现已经安装过了openssl

brew info openssl

发现缺少了一个makebuild的依赖

brew install makebuild

安装这个依赖之后,再次查看openssl的info

brew info openssl

哦?!依赖报错没有了

思考了一下,我是否可以直接用brew install安装的openssl来安装php,so。。。

./configure --prefix=/data/php-fpm --with-apxs2=/usr/sbin/apxs --enable-fpm --with-fpm-user=myname --with-fpm-group=myname --with-mysqli --with-pdo-mysql --with-iconv-dir --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --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.2f --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --disable-fileinfo --enable-maintainer-zts

T_T感动的落泪了。终于换了一个报错

configure: error: Cannot locate header file libintl.h

搜到了大牛的一篇文章:

google了一下,这里有解决办法:PHP with Intl and Gettext on OSX Lion。

大致步骤是:

1、安装ICU

tar xzvf icu4c-4_8_1-src.tgz
cd icu/source
./runConfigureICU MacOSX
make
sudo make install

2、安装PHP自带的intl扩展

找了半天终于找到了下载地址

wget http://download.icu-project.org/files/icu4c/4.2.1/icu4c-4_2_1-src.tgz  

执行完最后的sudo make install之后,再次执行./configure

waiting...

依旧报错:

configure: error: Cannot locate header file libintl.h

执行第二步: 安装php自带的intl扩展

./configure --prefix=/data/php-fpm --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-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --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 --enable-intl --with-openssl=/usr/local/Cellar/openssl/1.0.2f --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --disable-fileinfo --enable-maintainer-zts

waiting

还是报错。。。。

F!手动安装

cd ext/intl
/usr/local/php/bin/phpize intl
./configure --enable-intl
make

报错:

In file included from /data/php5.6/ext/intl/php_intl.c:25:
./php_intl.h:23:10: fatal error: 'php.h' file not found
#include <php.h>
         ^
1 error generated.

F

源码安装搞不定intl了,试试看PECL安装。

I can't open PEAR, so..

Try another method:

http://www.codeweblog.com/configure-error-cannot-locate-header-file-libint/

是不是缺少了gettext底层依赖,所以报错?

未完啊未完

Continue

/php5.6目录下,重新配置configure

./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php --with-mysql --with-mysqli --enable-pdo --with-pdo-mysql --with-mysql-sock=/tmp/mysql.sock --enable-opcache --enable-cgi --enable-fpm --enable-sockets --enable-mbstring --enable-mbregex --enable-bcmath --enable-xml --enable-zip --with-zlib --with-gd --with-png-dir=/usr/local/lib/libpng --with-jpeg-dir=/usr/local/lib/libjpeg --with-curl --with-mhash=/usr/local/lib/libmhash --with-mcrypt=/usr/local/lib/libmcrypt --with-iconv=/usr/local/lib/libiconv --with-openssl

提示

Cann't find evp.h 

发现是在安装openssl的时候报错。

查看configure文件

vim configure

在vim命令行下搜索evp.h

找到了openssl的搜索目录。其实在搜索的这三个目录下,没有openssl这个库导致的报错。

将以前下载好的openssl库进行copy,copy到指定的搜索目录。

继续安装。

成功。

参考

  1. http://serverfault.com/questions/415458/php-error-cannot-find-openssls-evp-h

  2. http://note.rpsh.net/posts/2015/10/07/installing-php-intl-extension-os-x-el-capitan/


niecprea
871 声望54 粉丝

Hello world!