complie---php5.6源码编译

本文提供了一套详细的指南,用于在CentOS 6.4环境中从源码编译安装PHP 5.6版本。教程涵盖了安装所需的依赖包、下载PHP源码、配置编译选项及安装过程等关键步骤,并介绍了如何配置PHP-FPM以启动和管理PHP进程。

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

环境:centos 6.4
php下载地址:http://php.net/downloads.php

php编译安装

极简编译参考:http://cn2.php.net/manual/zh/install.unix.nginx.php
安装php必须 安装的依赖
yum install libxml2 libxml2-devel bzip2-devel gmp-devel

yum -y install wget
cd /home
wget http://cn2.php.net/distributions/php-5.6.11.tar.gz
tar -zxvf php-5.6.11.tar.gz
cd php-5.6.11

#configure 核心参数参考:http://cn2.php.net/manual/zh/configure.about.php

'./configure' '--enable-fpm' '--with-mysqli' '--prefix=/usr/local/php5.6' '--with-config-file-path=/usr/local/php5.6/etc' '--disable-debug' '--with-pic' '--disable-rpath' '--without-pear' '--with-bz2' '--without-gdbm' '--with-gettext' '--with-gmp' '--with-iconv' '--with-openssl' '--with-zlib' '--with-layout=GNU' '--enable-exif' '--enable-ftp' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-sysvmsg' '--with-kerberos' '--enable-shmop' '--enable-calendar' '--enable-xml' '--without-mysql' '--with-gd' '--disable-dom' '--disable-dba' '--without-unixODBC' '--enable-pdo' '--disable-xmlreader' '--disable-xmlwriter' '--with-sqlite3' '--disable-phar' '--disable-fileinfo' '--enable-json' '--without-pspell' '--disable-wddx' '--with-curl' '--disable-posix' '--disable-sysvmsg' '--disable-sysvshm' '--disable-sysvsem' '--with-mcrypt' '--with-pdo-mysql' '--with-jpeg-dir' '--with-png-dir' '--enable-gd-native-ttf' '--with-freetype-dir' '--enable-mbstring' 
make && make install
cp php.ini-development /usr/local/php5.6/etc/php.ini
cd /usr/local/php5.6/etc
cp php-fpm.conf.default php-fpm.conf
cd ..
sbin/php-fpm -D

php-fpm: 开启和关闭

参数:
INT, TERM 立刻终止
QUIT 平滑终止
USR1 重新打开日志文件
USR2 平滑重载所有worker进程并重新载入配置和二进制模块

使用方法:

kill -INT/QUIT/USR1/USR2 进程号

编译扩展: mcrypt

下载地址: http://cn2.php.net/manual/zh/mcrypt.requirements.php

注意:安装php 的mcrypt 扩展只需要安装 libmcrypt

yum install libtool-ltdl-devel
./configure  --disable-posix-threads --enable-dynamic-loading
make && make install 
cd /home/php-5.6.11
./configure 其他一些扩展 --with-mcrypt
到这会报错:Don't know how to define struct flock on this system, set --enable-opcache=no
解决办法:
vi /etc/ld.so.conf.d/local.conf
加入 /usr/local/lib
ldconfig -v
make && make install

编译curl 扩展

yum -y install libcurl libcurl-devel
./configure 其他一些扩展  --with-curl

编译pdo_mysql扩展

yum -y install pdo_mysql
./configure 其他一些扩展 --with-pdo-mysql

编译GD库

yum -y install libjpeg-devel libpng-devel  freetype-devel
./configure 其他一些扩展 --with-gd --with-jpeg-dir --with-png-dir --enable-gd-native-ttf --with-freetype-dir
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值