简介:
LNMP=Linux+nginx+MySQL+php
和LAMP安装PHP方法有差别,需要开启php-fpm服务,需要添加php-fpm用户
清空之前编译过的php配置(安装过php的)
cd /usr/local/src/php-5.6.30make clean
下载和解压
cd /usr/local/src/wget http://cn2.php.net/distributions/php-5.6.30.tar.gztar zxvf php-5.6.30.tar.gz
添加用户php-fpm
useradd -s /sbin/nologin php-fpm
指定配置
cd /usr/local/src/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
复制php.ini文件
cp /usr/local/src/php-5.6.30/php.ini-production /usr/local/php-fpm/etc/php.ini
创建conf文件
cd /usr/local/php-fpm/etc/vim php-fpm.conf
增加代码[global]pid = /usr/local/php-fpm/var/run/php-fpm.piderror_log = /usr/local/php-fpm/var/log/php-fpm.log[www]listen = /tmp/php-fcgi.sock#listen = 127.0.0.1:9000listen.mode = 666user = php-fpmgroup = php-fpmpm = dynamicpm.max_children = 50pm.start_servers = 20pm.min_spare_servers = 5pm.max_spare_servers = 35pm.max_requests = 500 ?rlimit_files = 1024
复制启动脚本
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-fpmchkconfig --list
检测与启动
/usr/local/php-fpm/sbin/php-fpm -tservice php-fpm startps aux |grep php-fpm
错误1:
configure: error: Please reinstall the libcurl distribution - ???easy.h should be in <curl-dir>/include/curl/
搜索curl,相应的包yum list |grep -i curl
选着devel的包安装
yum install -y libcurl-devel
LNMP构架-简介与php安装(与lamp不同)
原文地址:http://blog.51cto.com/shuzonglu/2085780