系统环境
CentOS 6.5 64位
Nginx 1.6.2
MySQL 5.6.23
PHP 5.6.6
依赖库
#为了省事,直接用yum来安装吧 yum -y install libmcrypt-devel libxml2-devel curl-devel libjpeg-devel libpng-devel freetype-devel openssl-devel
mkdir -p /var/logs/php
./configure \ --prefix=/usr/local/php \ --with-config-file-path=/usr/local/etc/php \ --with-mysql=/usr/local/mysql \ --with-mysqli \ --with-gd \ --with-jpeg-dir \ --with-png-dir \ --with-freetype-dir \ --with-curl \ --enable-mbstring \ --enable-sockets \ --enable-pcntl \ --enable-fpm \ --with-fpm-user=nginx \ --with-fpm-group=nginx \ --with-mcrypt \ --with-openssl \ --with-pdo-mysql \ --with-libxml-dir \ --with-zlib \ --with-pcre-dir
make && make install
配置php-fpm.conf
cp /usr/local/php/etc/php-fpm.conf.default /usr/local/etc/php/php-fpm.conf vi /usr/local/etc/php/php-fpm.conf
注:user和group要跟nginx的运行用户和组保持一致
配置php.ini
cp /usr/local/src/php-5.6.6/php.ini-development /usr/local/etc/php/php.ini vi /usr/local/etc/php/php.ini
启动php-fpm
/usr/local/php/sbin/php-fpm -c /usr/local/etc/php/php.ini -y /usr/local/etc/php/php-fpm.conf
重新启动nginx
/usr/local/sbin/nginx/nginx -s stop /usr/local/sbin/nginx/nginx -c /usr/local/etc/nginx/nginx.conf
以上就介绍了CentOS以源码方式安装PHP,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。