系统版本:CentOS-6.5-x86_64-minimal
内核版本:2.6.32-696.10.2.el6.x86_64
安装PHP依赖
yum -y install gcc gcc-c++ libxml2 libxml2-devel openssl openssl-devel bzip2 bzip2-devel curl-devel libjpeg-devel libpng libpng-devel freetype-devel libtool-ltdl-devel make cmake autoconf automake zlib ncurses-devel bison libiconv libmcrypt mhash mcrypt pcre-devel libcurl-devel mysql-devel
安装更新libtool
wget http://ftp.gnu.org/gnu/libtool/libtool-1.5.6.tar.gz
chmod +x *
tar xfz libtool-1.5.6.tar.gz
cd libtool-1.5.6
./configure
make && make install
替换旧的libtool
rm –rf /usr/local/httpd2/build/libtool
ln -s /usr/local/bin/libtool /usr/local/httpd2/build/libtool
cd /usr/local/bin/libtool
find / -name libtool
ln -s /usr/local/bin/libtool /usr/local/httpd24/build/libtool
ln -s /usr/local/bin/libtool /root/php-5.3.29
rm -rf libtool
ln -s /usr/local/bin/libtool /root/php-5.3.29
cp /usr/local/httpd24/build/libtool /root/php-5.3.29
连接 MySQL
mkdir /usr/lib/mysql/
cp /usr/lib64/mysql/* /usr/lib/mysql/
export LDFLAGS=-L/usr/lib64/mysql
编译 PHP
wget http://distfiles.macports.org/php5/php-5.3.29.tar.bz2
tar jxvf php-5.3.29.tar.bz2
cd php-5.3.29
./configure --prefix=/usr/local/php --with-mysql --with-mysqli --with-pdo_mysql --with-iconv-dir --with-zlib --with-libxml-dir --enable-xml --with-curl enable-mbstring --with-gd --with-openssl --with-mhash --enable-sockets --with-xmlrpc --enable-zip --enable-soap --with-freetype-dir=/usr/lib64 --with-apxs2=/usr/local/httpd24/bin/apxs --enable-shared --enable-soap --enable-sockets --with-mysql-dir=/usr/lib64/mysql/
如果手动连接 MySQL x64机子需要修改
将Makefile里面的-L/usr/lib/mysql改为-L/usr/lib64/mysq
安装 PHP
make && make install
// 安装完提示
Installing PEAR environment: /usr/local/php/lib/php/
[PEAR] Archive_Tar - installed: 1.3.12
[PEAR] Console_Getopt - installed: 1.3.1
[PEAR] Structures_Graph- installed: 1.0.4
[PEAR] XML_Util - installed: 1.2.3
[PEAR] PEAR - installed: 1.9.5
Wrote PEAR system config file at: /usr/local/php/etc/pear.conf
You may want to add: /usr/local/php/lib/php to your php.ini include_path
/root/php-5.3.29/build/shtool install -c ext/phar/phar.phar /usr/local/php/bin
ln -s -f /usr/local/php/bin/phar.phar /usr/local/php/bin/phar
Installing PDO headers: /usr/local/php/include/php/ext/pdo/
1、修复
rm -rf /usr/local/php/lib/php/.channels
/usr/local/php/bin/pecl update-channels
添加 php 到 Apache
AddType application/x-httpd-php .php
LoadModule php5_module modules/libphp5.so
<IfModule mod_php5.c>
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
</IfModule>