美文网首页
编译安装php7.2

编译安装php7.2

作者: 博楠同学 | 来源:发表于2019-04-03 20:24 被阅读0次

1、

apt-get   install    libxml2  libxml2-dev    autoconf   gcc     bzip2   libzip-dev   libssl-dev   libcurl-dev

安装编译安装所需要的依赖

去官网下载php,放在/usr/local/src/

cd  /usr/local/src

tar   zxvf    php-7.2.16.tar.gz

cd php-7.2.16

编译安装一些必要的扩展

./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --enable-mysqlnd    --with-pdo-mysql=mysqlnd --with-gd --with-openssl  --with-iconv                --with-curl   --enable-mbstring   --enable-zip --enable-fpm  --with-pear --with-zlib      

报错

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

    安装libsll资源库

  apt-get  install libssl-dev

报错

configure: error: Cannot find OpenSSL's libraries

出现这种有2中情况,一种是没有安装 openssl,另一种是安装了找不到libssl.so 文件。

先安装openssl

sudo apt-get install openssl

如果还提示该错误的话,查找一下libssl.so所在位置,重新连接一下

find / -name libssl.so

输出

/usr/lib/x86_64-linux-gnu/libssl.so

说明 libssl.so在这个位置

然后重新连接一下

ln -s /usr/lib/x86_64-linux-gnu/libssl.so  /usr/lib

安装报错

configure: error: Please reinstall the libcurl distribution - easy.h should be in <curl-dir>/include/curl/

执行

sudo apt-get install libcurl-ocaml-dev

安装gd库报错

configure: error: png.h not found.

  执行

apt-get  install libpng++-dev

apt-get install libjpeg-dev

报错

checking for libzip... configure: error: system libzip must be upgraded to version >= 0.11

apt-get  remove -y libzip

#下载编译安装

wget https://nih.at/libzip/libzip-1.2.0.tar.gz

tar -zxvf libzip-1.2.0.tar.gz

cd libzip-1.2.0

./configure

make && make install

报错:

collect2:error: ld returned 1 exit status

make: *** [sapi/cli/php] Error 1

解决:
在PHP源码目录下 vi Makefile 打开文件,找到 EXTRA_LIBS 行,在行末添加 -llber 保存退出再次make即可

重新执行上面的命令./configure

make  

make install

相关文章

网友评论

      本文标题:编译安装php7.2

      本文链接:https://www.haomeiwen.com/subject/ivhtiqtx.html