System environment
CentOS 6.5 64-bit
Nginx 1.6.2
MySQL 5.6.23
PHP 5.6.6
Dependent libraries
#为了省事,直接用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
Configure 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
Note: user and group must be consistent with the running user and group of nginx
Configure 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
Start php-fpm
/usr/local/php/sbin/php-fpm -c /usr/local/etc/php/php.ini -y /usr/local/etc/php/php-fpm.conf
Restart nginx
/usr/local/sbin/nginx/nginx -s stop /usr/local/sbin/nginx/nginx -c /usr/local/etc/nginx/nginx.conf
The above introduces how to install PHP in source code mode on CentOS, including the relevant aspects. I hope it will be helpful to friends who are interested in PHP tutorials.