-
下载php 安装包, 下载地址:http://mirrors.sohu.com/php/ 选择php版本.tar.gz 的编译包即可 xshell命令下载方式:(连接可以由鼠标右键,得到图片中的下载链接) wget http://mirrors.sohu.com/php/php-5.6.0.tar.gz
-
安装编译工具、依赖包 yum install libxml2 libxml2-devel openssl openssl-devel bzip2 bzip2-devel libcurl libcurl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel gmp gmp-devel libmcrypt libmcrypt-devel readline readline-devel libxslt libxslt-devel -y
-
解压PHP tar -zxvf php-5.6.0.tar.gz
cd php-5.6.0
-
编译安装
./configure --prefix=/usr/local/php --with-config-file-path=/etc --enable-fpm --enable-inline-optimization --disable-debug --disable-rpath --enable-shared --enable-soap --with-libxml-dir --with-xmlrpc --with-mcrypt --with-mhash --with-pcre-regex --with-sqlite3 --with-zlib --enable-bcmath --with-iconv --with-bz2 --enable-calendar --with-curl --with-cdb --enable-dom --enable-exif --enable-fileinfo --enable-filter --with-pcre-dir --enable-ftp --with-gd --with-jpeg-dir --with-png-dir --with-zlib-dir --with-freetype-dir --enable-gd-native-ttf --enable-gd-jis-conv --with-gettext --with-gmp --with-mhash --enable-json --enable-mbstring --enable-mbregex --enable-mbregex-backtrack --with-libmbfl --with-onig --enable-pdo --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-zlib-dir --with-pdo-sqlite --with-readline --enable-session --enable-shmop --enable-simplexml --enable-sockets --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-wddx --with-libxml-dir --with-xsl --enable-zip --enable-mysqlnd-compression-support --with-fpm-group=nginx --with-fpm-user=nginx --enable-pcntl --with-mysql
make && make install
5.将编译包中的php.ini-development复制到 php的安装目录下的/usr/local/php/etc/php.ini
cp /mnt/php-5.6.0/php.ini-development /usr/local/php/etc/php.ini
cd /usr/local/php/etc
cp php-fpm.conf.default php-fpm.conf
php-fpm.conf文件中 可以修改 默认php的端口9000 默认端口参数:listen = 127.0.0.1:9000
-
服务管理 启动 : /usr/local/php/sbin/php-fpm
关闭: pkill php-fpm
重载: pkill -USR2 php-fpm
-
开机启动 vi /etc/rc.local
/usr/local/php/sbin/php-fpm
-
nginx与php结合
index index.php index.html index.htm;
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
-
配置PATH
echo "export PATH=$PATH:/usr/local/php/bin" >> /etc/profile
source /etc/profile
|