编译安装php7.2

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

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容