LNMP配置——PHP安装

一、下载

#cd /usr/local/src  

//软件包都放在这里方便管理

#wget http://cn2.php.net/distributions/php-5.6.30.tar.gz

二、解压

#tar zxf php-5.6.30.tar.gz

三、安装与配置

# yum install -y install gcc libxml2 libxml2-devel openssl openssl-devel libcurl curl-devel libjpeg-devel libpng libpng-devel freetype-devel epel-release

# yum install -y php-mcrypt  libmcrypt  libmcrypt-devel

 #useradd -s /sbin/nologin php-fpm

#cd php-5.6.30

#./configure --prefix=/usr/local/php-fpm --with-config-file-path=/usr/local/php-fpm/etc --enable-fpm --with-fpm-user=php-fpm --with-fpm-group=php-fpm --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-pdo-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 --with-pear --with-curl  --with-openssl

#make && make install (安装时间会很久)

# cp /usr/local/src/php-5.6.30/php.ini-production /usr/local/php-fpm/etc/php.ini

 #vim /usr/local/php-fpm/etc/php-fpm.conf

把下列文件写入 php-fpm.conf

[global]

pid = /usr/local/php-fpm/var/run/php-fpm.pid

error_log = /usr/local/php-fpm/var/log/php-fpm.log

[www]

user = php-fpm

group = php-fpm

listen = /tmp/php-fcgi.sock

listen.mode = 666

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-fpm/sbin/php-fpm -t

tset is successful                //代表成功

#  cd /usr/local/src/php-5.6.30

# 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

 cd /usr/local/php-fpm/

 sbin/php-fpm -t

 service php-fpm start

 ps -ef |grep php

 ll  /tmp/php-fcgi.sock

 

四、测试安装

#ps aux |grep  php-fpm

//会显示大概20多个进程

 

 

posted @ 2021-03-10 10:04  清空。  阅读(68)  评论(0)    收藏  举报