首页 > 代码库 > PHP 编译安装

PHP 编译安装

1, 获取源码
wget -O php.tar.gz http://am1.php.net/get/php-5.6.27.tar.gz/from/this/mirror

tar zxvf php.tar.gz

cd php-5.6.27
2, 创建用户和组

groupadd php
useradd php -g php

3, 安装依赖

yum install libxml2-devel libcurl-devel libjpeg-turbo-devel libpng-devel freetype-devel

4, 编译安装


./configure --prefix=/usr/local/php --enable-opcache --enable-fpm --enable-sockets --enable-mysqlnd --enable-gd-native-ttf --with-fpm-user=php --with-fpm-group=php --with-pdo-mysql --with-gd --with-jpeg-dir=/usr/lib/ -with-freetype-dir=/usr/lib --with-curl

make && make install

5, 自启动脚本

cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
chmod 755 /etc/init.d/php-fpm
chkconfig --add php-fpm
chkconfig php-fpm on

6, 配置
phpconf.zip
复制到/usr/local/php/lib/php.ini
复制到/usr/local/php/etc/php-fpm.conf

http://files.cnblogs.com/files/mysic/phpconf.zip

PHP 编译安装