LNMP-PHP安装
PHP安装
- 和LAMP安装PHP是有差别的,需要开启php-fpm服务
- cd /usr/src/local/
- wget http://hk1.php.net/get/php-7.2.0.tar.gz/from/this/mirror #下载7.2.0
- ./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
checking for cURL 7.10.5 or greater... configure: error: cURL version 7.10.5 or later is required to compile php with cURL support
- curl —version 查看版本是7.29.0?,查看php 搜索关键字curl 查看requirements需要安装libcurl,rpm -qa libcurl 显示的也是7.29.0
yum search curl 看到有devel包而,我们好像没有安装这个开发包,所以yum -y install libcurl-devel - 之后./configure … 之后有php5.0的参数去掉,重新./configure..
-
make && make install
-
cp php.ini-production /usr/local/php-fpm/etc/php.ini #从源文件中拷贝配置文件
- cp /usr/local/php-fpm/etc/php-fpm.conf.default /usr/local/php-fpm/etc/php-fpm.conf #编辑
[global]
;include=/usr/local/php-fpm/etc/php-fpm.d/*.conf
pid = /usr/local/php-fpm/var/run/php-fpm.pid
error_log = /usr/local/php-fpm/var/log/php-fpm.log
[www]
listen = /tmp/php-fcgi.sock
;listen = 127.0.0.1:9000
listen.mode = 666
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
- useradd -s /sbin/nologin php-fpm
- cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm #源码中拷贝服务启动文件到服务启动处
- chmod 755 /etc/init.d/php-fpm #给其root执行权限
- chkconfig —add php-fpm #加入开机启动项
- chkconfig php-fpm on #开机启动
- service php-fpm start #启动服务