码迷,mamicode.com
首页 > Web开发 > 详细

CentOS7.3编译安装PHP

时间:2019-05-07 22:56:04      阅读:190      评论:0      收藏:0      [点我收藏+]

标签:bst   完成   evel   usr   art   --   php-fpm   ml2   mcrypt   

系统:CentOS Linux release 7.3.1611
内核:3.10.0-514.el7.x86_64
PHP:php-5.3.27.tar.gz

步骤:
#yum install -y libxml2 libxml2-devel curl curl-devel freetype freetype-devel libpng libpng-devel libjpeg-devel openssl openssl-devel

下载php:
#wget http://am1.php.net/distributions/php-5.3.27.tar.gz
#cp php-5.3.27.tar.gz /usr/local/src
#cd /usr/local/src
#tar -zxvf php-5.3.27.tar.gz
#useradd -s /sbin/nologin php-fpm
#./configure \
--prefix=/usr/local/php \
--with-config-file-path=/usr/local/php/etc \
--enable-fpm \
--with-fpm-user=php-fpm \
--with-fpm-group=php-fpm \
--with-mysql=/usr/local/mysql \
--with-mysql-sock=/tmp/mysql.sock \
--with-libxml-dir \
--with-gd \
--with-jpeg-dir \
--with-png-dir \
--with-freetype-dir \
--with-iconv-dir \
--with-zlib-dir \
--with-mcrypt \
--enable-soap \
--enable-gd-native-ttf \
--enable-ftp \
--enable-mbstring \
--enable-exif \
--disable-ipv6 \
--with-pear \
--with-curl \
--with-openssl
#make
#make test
#make install

编辑配置文件:
#cd /usr/local/php/etc/
#cp php-fpm.conf.default php-fpm.conf
#vim /usr/local/php/etc/php-fpm.conf

加入如下配置信息:
[global]
pid = /usr/local/php/var/run/php-fpm.pid
error_log = /usr/local/php/var/log/php-fpm.log
[www]
listen = /tmp/php-fcgi.sock
user = php-fpm
group = php-fpm
pm = dynamic
pm.max_children = 50
pm.start_servers = 20
pm.min_spare_servers = 5
pm.max_spare_servers = 35
pm.max_requests = 500
rlimit_files = 1024

检查配置文件语法是否正确:
#/usr/local/php/sbin/php-fpm -t
出现NOTICE: configuration file /usr/local/php/etc/php-fpm.conf test is successful即成功
#cp /usr/local/src/php-5.3.27/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
#chmod 755 /etc/init.d/php-fpm
#chmod php-fpm on

启动php-fpm
#/etc/init.d/php-fpm start

查看进程:
#ps aux | grep php-fpm

至此,php编译安装完成。

CentOS7.3编译安装PHP

标签:bst   完成   evel   usr   art   --   php-fpm   ml2   mcrypt   

原文地址:https://blog.51cto.com/169293/2390687

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!