php-5.4.15 centos安装手册
1、权限
请以root权限登陆 如果非root权限登陆,请运行sudo su - 命令切换到root权限2、准备好编译环境(如果安装了可以省略)
yum -y install wget gcc gcc-c++ ncurses-devel cmake make perlyum -y install libmcrypt-devel mhash-devel libxslt-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel
3、准备好centos所需要的用户组(如果创建了可以省略)
3.1、新增用户组 groupadd www3.2、新增用户
useradd www -g www4、准备好源代码安装目录(如果创建了可以省略)
mkdir -p /root/src cd /root/src5、下载、编译libmcrypt
5.1、下载libmcrypt源代码压缩包 wget5.2、解压源代码
tar -vxzf libmcrypt-2.5.8.tar.gz5.3、进入源代码目录
cd libmcrypt-2.5.85.4、通过configure生成Makefile
./configure5.5、编译libmcrypt
make5.5、安装libmcrypt
make install6、下载、编译php
6.1、下载php源代码压缩包 wget6.2、解压源代码
tar -vxzf php-5.4.15.tar.gz6.3、进入源代码目录
cd php-5.4.156.4、通过configure生成Makefile
./configure --prefix=/usr/local/php --enable-fpm --with-mcrypt --with-zlib --enable-mbstring --disable-pdo --with-curl --disable-debug --disable-rpath --enable-inline-optimization --with-bz2 --with-zlib --enable-sockets --enable-sysvsem --enable-sysvshm --enable-pcntl --enable-mbregex --with-mhash --enable-zip --with-pcre-regex --with-mysqlprefix是指安装目录,一般安装在/usr/local/php
6.5、编译php
make6.5、安装php
make install7、复制配置文件php-fpm和php.ini
7.1、复制php-fpm cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf 7.2、复制php.ini 产品 cp php.ini-production /usr/local/php/lib/php.ini 开发 cp php.ini-development /usr/local/php/lib/php.ini gd库 cd /ext/gd /usr/local/bin/phpize ./configure --with-php-config=/usr/local/php/bin/php-config --with-png-dir --with-freetype-dir --with-jpeg-dir --with-zlib-dir --with-gd 8、配置php-fpm.conf pid=/usr/local/php/var/run/php-fpm.pid user = www group = www pm = static pm.max_children = 64==================================
mynote:以上修改内容在php-fpm.conf文件中找到对应的地方一一修改9、启动暂停php-fpm
9.1、启动php-fpm /usr/local/php/sbin/php-fpm确认
ps -elf | grep php | wc -l 根据刚才的php-fpm.conf应该输出是669.2、暂停php-fpm
kill -INTcat /usr/local/php/var/run/php-fpm.pid
9.3、php-fpm 重启:
kill -USR2cat /usr/local/php/var/run/php-fpm.pid