PHP安装笔记
系统环境
CentOS-6.3
php-5.3.17.tar.gz
官方下载:http://www.php.net/get/php-5.3.17.tar.gz/from/this/mirror
一、 安装编译工具
yum install gcc gcc++ yum install gcc gcc-c++ gcc-g77
二、 编译安装PHP5.2.9所需的支持库
yum install freetype-devel yum install libxml2-devel yum install openssl-devel yum install libcurl-devel
jpegsrc.v7.tar.gz
tar zxvf jpegsrc.v7.tar.gz cd jpeg-7/ ./configure make make install
libpng-1.5.5.tar.gz
tar zxvf libpng-1.5.5.tar.gz cd libpng-1.5.5/ ./configure make make install
libiconv-1.14.tar.gz
tar zxvf libiconv-1.14.tar.gz cd libiconv-1.14/ ./configure --prefix=/usr/local makemake install
libmcrypt-2.5.8.tar.gz
tar zxvf libmcrypt-2.5.8.tar.gz cd libmcrypt-2.5.8/ ./configure make make install /sbin/ldconfig cd libltdl/ ./configure --enable-ltdl-install make make install ln -s /usr/local/lib/libmcrypt.la /usr/lib/libmcrypt.la ln -s /usr/local/lib/libmcrypt.so /usr/lib/libmcrypt.so ln -s /usr/local/lib/libmcrypt.so.4 /usr/lib/libmcrypt.so.4 ln -s /usr/local/lib/libmcrypt.so.4.4.8 /usr/lib/libmcrypt.so.4.4.8 ln -s /usr/local/lib/libmhash.a /usr/lib/libmhash.a ln -s /usr/local/lib/libmhash.la /usr/lib/libmhash.la ln -s /usr/local/lib/libmhash.so /usr/lib/libmhash.so ln -s /usr/local/lib/libmhash.so.2 /usr/lib/libmhash.so.2 ln -s /usr/local/lib/libmhash.so.2.0.1 /usr/lib/libmhash.so.2.0.1
/sbin/ldconfig
mhash-0.9.9.9.tar.gz
tar zxvf mhash-0.9.9.9.tar.gz cd mhash-0.9.9.9/ ./configure make make install
mcrypt-2.6.8.tar.gz
tar zxvf mcrypt-2.6.8.tar.gz cd mcrypt-2.6.8/ ./configure make make install
gd-2.0.33.tar.gz
tar zxvf gd-2.0.33.tar.gz cd gd-2.0.33/ ./configure --prefix=/usr/local/gd2 --with-freetype=/usr/local/freetype --with-png=/usr/local/libpng --with-jpeg=/usr/local/jpeg make make install
php-5.3.17.tar.gz
tar zxvf php-5.3.17.tar.gz gzip -cd php-5.3.17-fpm-0.5.10.diff.gz | patch -d php-5.2.9 -p1 cd php-5.3.17/ ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-iconv-dir=/usr/local --with-mysqli --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-discard-path --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-fastcgi --enable-fpm --enable-force-cgi-redirect --enable-mbstring --with-mcrypt --with-gd=/usr/local/gd2/ --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets
make ZEND_EXTRA_LIBS='-liconv' make install cp php.ini-dist /usr/local/php/etc/php.ini
编译前添加静态ZLIB支持否则getimagesize无法解析SWC文件,在main/php_config.h中添加#undef COMPILE_DL_ZLIB编译选项
平滑重启Php
/usr/local/php/sbin/php-fpm restart
php-fpm的其他命令:start | stop | quit | restart | reload | logrotate