CentOS下PHP的编译安装

本文详细介绍了如何从源码编译安装 PHP 5.6 版本,并配置相关参数以确保其正常运行。包括获取安装包、安装依赖程序、编译配置选项及最终的配置文件调整。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 

#获取安装包
wget http://cn2.php.net/distributions/php-5.6.23.tar.gz

tar -zxvf php-506.23.tar.gz

cd php-5.6.23

#依赖程序
yum install gcc
yum install libxml2
yum install libxml2-devel -y
yum install openssl openssl-devel
yum install libpng
yum install libpng-devel
yum install freetype 
yum install freetype-devel
yum install libxslt-devel

yum -y install libjpeg-devel

 

#编译
./configure --prefix=/usr/local/php --with-mysql --with-curl --with-freetype-dir --with-jpeg-dir --with-gd --with-gettext --with-iconv-dir --with-kerberos --with-libdir=lib64 --with-libxml-dir --with-mysqli --with-openssl --with-pcre-regex --with-pdo-mysql --with-pdo-sqlite --with-pear --with-png-dir --with-xmlrpc --with-xsl --with-zlib --enable-fpm --enable-bcmath --enable-libxml --enable-inline-optimization --enable-gd-native-ttf --enable-mbregex --enable-mbstring --enable-opcache --enable-pcntl --enable-shmop --enable-soap --enable-sockets --enable-sysvsem --enable-xml --enable-zip


#yum -y install libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel mysql pcre-devel openssl openssl-devel
#yum -y install curl-devel
#yum -y install libxslt-devel


make
make test
make install
make clean
cp php.ini-development /usr/local/php/etc/php.ini

vi /usr/local/php/etc/php.ini
date.timezone = ‘Asia/Shanghai’

mv php-fpm.conf.default php-fpm.conf


/usr/local/php/sbin/php-fpm


#php配置文件路径
/usr/local/php/lib/php.ini

查看进程号
ps -aux | grep php-fpm

 

php-fpm重启
killall php-fpm
/usr/local/php/sbin/php-fpm

转载于:https://www.cnblogs.com/wwwx/p/5659311.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值