因项目需要,今天在已经通过 yum 安装 PHP 7.2.17环境下,在安装一个PHP 5.6.40,使得环境满足多版本PHP
而这个PHP 5.6.40 只能通过编译安装了,用惯了yum,编译安装真是让人保持心态平和,折腾了一天,终于成功。
关键命令:
[root@iZbp1319y2gcmn0mb0l7j8Z ~]# wget https://www.php.net/distributions/php-5.6.40.tar.gz
[root@iZbp1319y2gcmn0mb0l7j8Z ~]# tar -zxvf php-5.6.40.tar.gz
[root@iZbp1319y2gcmn0mb0l7j8Z ~]# cd php-5.6.40
[root@iZbp1319y2gcmn0mb0l7j8Z php-5.6.40]# ./configure --prefix=/usr/local/php56 --with-config-file-path=/usr/local/php56/etc --enable-fpm --with-bz2 --with-gd --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-zlib-dir --with-iconv-dir=/usr/local --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-ftp --enable-mbstring --enable-exif --disable-ipv6 --with-curl --enable-bcmath --enable-sockets --enable-calendar --with-gettext --with-pdo-mysql=mysqlnd --disable-fileinfo --with-ldap --with-openssl --with-pear --with-xmlrpc --enable-gd-native-ttf
[root@iZbp1319y2gcmn0mb0l7j8Z php-5.6.40]# yum install libxml2-devel
configure: error: Cannot find OpenSSL's <evp.h>
[root@iZbp1319y2gcmn0mb0l7j8Z php-5.6.40]# yum install openssl openssl-devel
configure: error: Please reinstall the BZip2 distribution
[root@iZbp1319y2gcmn0mb0l7j8Z php-5.6.40]# yum install bzip2 bzip2-devel -y
configure: error: Please reinstall the libcurl distribution -
easy.h should be in <curl-dir>/include/curl/
[root@iZbp1319y2gcmn0mb0l7j8Z php-5.6.40]# yum install curl curl-devel -y
configure: error: jpeglib.h not found.
[root@iZbp1319y2gcmn0mb0l7j8Z php-5.6.40]# yum -y install libjpeg-devel
configure: error: png.h not found.
[root@iZbp1319y2gcmn0mb0l7j8Z php-5.6.40]# yum install libpng libpng-devel -y
configure: error: freetype-config not found.
[root@iZbp1319y2gcmn0mb0l7j8Z php-5.6.40]# yum install freetype-devel -y
configure: error: Cannot find ldap.h
[root@iZbp1319y2gcmn0mb0l7j8Z php-5.6.40]# yum install openldap-devel -y
configure: error: Cannot find ldap libraries in /usr/lib.
[root@iZbp1319y2gcmn0mb0l7j8Z php-5.6.40]# find / -name libldap*
[root@iZbp1319y2gcmn0mb0l7j8Z php-5.6.40]# cp -frp /usr/lib64/libldap* /usr/lib/
configure: error: mcrypt.h not found. Please reinstall libmcrypt.
[root@iZbp1319y2gcmn0mb0l7j8Z php-5.6.40]# yum install -y libmcrypt-devel
https://blog.youkuaiyun.com/kajweb/article/details/80211322
Makefile
找到 开头是 ‘EXTRA_LIBS’ 这一行 在结尾加上 ‘-llber’ 然后执行 make && make install
vi Makefile
/^EXTRA_LIBS
行尾加上 “-llber”,存盘退出
[root@iZbp1319y2gcmn0mb0l7j8Z php-5.6.40]# make && make install
php-fpm常用命名:
# 查看 php-fpm 用户
ps aux | grep php-fpm
# 查看 php-fpm 进程 pid
ps -ef | grep php-fpm
# 启动 php-fpm
php-fpm -D
# 关闭 php-fpm
kill -INT [pid]
# 重启 php-fpm
kill -USR2 [pid]

本文详细记录了在已安装PHP7.2.17的环境中,如何通过编译方式成功安装PHP5.6.40的过程,解决了配置过程中遇到的各种依赖问题。
838

被折叠的 条评论
为什么被折叠?



