Linux 下编译安装低版本 PHP5

Ubuntu 在编译安装低版本 PHP5 时可能发生的错误

  • checking for cURL in default path… not found
ln -s /usr/include/x86_64-linux-gnu/curl /usr/local/include/curl
  • make: *** [Makefile:636:ext/openssl/openssl.lo]
# 当前系统 openssl 版本不兼容 php5,需要降级 openssl 版本
# 进入下载目录
cd /usr/local/src
wget https://www.openssl.org/source/openssl-1.0.2k.tar.gz
# 解压
tar zxvf openssl-1.0.2k.tar.gz
# 编译
./config
make && make install 
# 配置
which ssl 	# 显示 /usr/bin/openssl
mv /usr/bin/openssl /usr/local/bin/openssl_bak
ln -s /usr/local/ssl/bin/openssl /usr/bin/openssl

开始编译 PHP5(只列出关键步骤,详情看 https://blog.csdn.net/hualaoshuan/article/details/90708525

# 部分依赖安装
# Ubuntu
apt-get libtool libdbd-mysql

# 安装到 /usr/local/php5 目录
# 注意 --with-openssl 配置
./configure --prefix=/usr/local/php5 --with-config-file-path=/usr/local/php5/etc \
--with-mysqli --with-pdo-mysql \
--with-mysql-sock=/tmp/mysql.sock --enable-sockets --enable-zip \
--with-fpm-user=www --with-fpm-group=www --enable-fpm --enable-gd-native-ttf \
--with-jpeg-dir --with-freetype-dir --with-gd --with-mcrypt --with-curl --with-openssl=/usr/local/ssl \
--with-xmlrpc --enable-bcmath --enable-shmop --enable-sysvsem --enable-soap \
--enable-inline-optimization --enable-mbregex --enable-mbstring --enable-pcntl \
--enable-gd-jis-conv --enable-ftp --with-zlib --with-mhash 
make
make install

# 配置文件
cp php.ini-production /usr/local/php5/etc/php.ini
cp sapi/fpm/init.d.php-fpm /etc/init.d/php5-fpm
cp /usr/local/php5/etc/php-fpm.conf.default /usr/local/php5/etc/php-fpm.conf
chmod +x /etc/init.d/php5-fpm

# 如果本机安装过 PHP7,需要关闭 PHP7 后再运行 PHP5
/etc/init.d/php-fpm stop
systemctl restart nginx
/etc/init.d/php5-fpm restart
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值