php编译安装

2019-10-01  本文已影响0人  王小板爱吃鱼

1. 安装php所需依赖


yum install gcc gcc-c++ libxml2 libxml2-devel autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel  zlib zlib-devel glibc glibc-devel glib2 glib2-devel

2. 下载php最新stable版本并安装


./configure --prefix=/usr/local/php --enable-fpm --with-zlib  --with-pdo-mysql --enable-mbstring --with-gd --with-png-dir=/usr/lib64 --with-jpeg-dir=/usr/lib64 --with-freetype-dir=/usr/lib64

make & make install


cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf

vim /usr/local/php/etc/php-fpm.conf  // 找到pid = run/php-fpm.pid,将前面的;号去掉

cp /usr/local/php-fpm/etc/php-fpm.d/www.conf.default /usr/local/php-fpm/etc/php-fpm.d/www.conf

cp php.ini-development /usr/local/php/lib/php.ini

cp sapi/fpm/php-fpm /usr/local/bin

vim /etc/profile  // 补充php环境变量/usr/local/php/bin:

source /etc/profile


vim /usr/local/php/lib/php.ini

定位到 cgi.fix_pathinfo= 并将其修改为如下所示:


cgi.fix_pathinfo=0

3. php-fpm基本管理


kill `cat /usr/local/php-fpm/var/run/php-fpm.pid`


kill -USR2 `cat /usr/local/php-fpm/var/run/php-fpm.pid`

上一篇 下一篇

猜你喜欢

热点阅读