Centos7 PHP 7.05部署文檔及普通用戶啓動

接下來進行參數配置,配置前若是沒有libxml2和libxml2-devel會報錯,因此應該更新libxml2並安裝libxml2-devel,使用在線安裝:

  由於不一樣的操做系統環境,系統安裝開發環境包的完整程度也不相同,因此建議安裝操做系統的時候作必要選擇,也能夠統一執行一遍全部的命令,將沒有安裝的組件安裝好,若是已經安裝了可能會進行升級,版本徹底一致則不會進行任何操做,命令除上面2個以外,彙總以下:php

yum -y install ntpdate lrzsz tree cmake gcc gcc-c++ autoconf l libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel libxslt-devel libtool-ltdl-devel make wget docbook-dtds asciidoc e2fsprogs-devel gd gd-devel openssl openssl-devel lsof git unzip gettext-devel gettext libevent libevent-devel pcre pcre-devel vim libxml2 libxml2-devel openssl openssl-devel curl-devel libjpeg-devel libpng-devel freetype-devel libm
crypt-devel bzip2 bzip-devel libxslt libxslt-devel freetype
wget -O php-7.0.5.tar.gz  http://cn2.php.net/get/php-7.0.5.tar.gz/from/this/mirror

tar -xzf php-7.0.5.tar.gz

cd php-7.0.5 

./configure --prefix=/data/php5 --with-curl --with-freetype-dir --with-gd --with-gettext --with-iconv-dir --with-kerberos --with-libdir=lib64 --with-libxml-dir --with-mysqli --with-openssl --with-pcre-regex --with-pdo-mysql --with-pdo-sqlite --with-pear --with-png-dir --with-jpeg-dir --with-xmlrpc --with-xsl --with-zlib --with-bz2 --with-mhash --enable-fpm --enable-bcmath --enable-libxml --enable-inline-optimization --enable-gd-native-ttf --enable-mbregex --enable-mbstring --enable-opcache --enable-pcntl --enable-shmop --enable-soap --enable-sockets --enable-sysvsem --enable-sysvshm --enable-xml --enable-zip


make && make install

chown -R xxxx:xxxx /data/php
cd php-7.0.5
cp php.ini-development /data/php/lib/php.ini
cp /data/php/etc/php-fpm.conf.default /data/php/etc/php-fpm.conf
cp sapi/fpm/php-fpm /usr/local/bin/
[root@iz2ze8ip0m748wp4lnu6pjz ~]# grep -v "#" /data/php/etc/php-fpm.d/www.conf | grep -v ";"

[www]

user = xxxx
group = xxxx
listen = 0.0.0.0:9000


pm = dynamic

pm.max_children = 5

pm.start_servers = 2

pm.min_spare_servers = 1

pm.max_spare_servers = 3
php-fpm #啓動
php-fpm啓動完畢以後,php-fpm服務默認使用9000端口,使用 netstat -tlnp | grep 9000 能夠查看端口使用狀況:9000端口正常使用,說明php-fpm服務啓動成功
  • 當使用普通用戶時會出現以下狀況:
php-fpm5
[06-Jan-2020 20:12:40] ERROR: unable to bind listening socket for address '127.0.0.1:9001': Address already in use (98)
[06-Jan-2020 20:12:40] ERROR: FPM initialization failed
  • 解決辦法以下(nginx普通用戶啓動也可如此操做)
[root@iz2u6pjz bin]# chown root:xxxx php-fpm
[root@iz2u6pjz bin]# ll /usr/local/bin/php-fpm
-rwxr-xr-x 1 root xxxx 39454128 Jan  6 19:39 /usr/local/bin/php-fpm
[root@iz2u6pjz data]# cd /usr/local/bin/
[root@iz2u6pjz bin]# chmod u+s php-fpm
[root@iz2u6pjz bin]# ll php-fpm
-rwsr-xr-x 1 root xxxx 39454128 Jan  6 19:39 php-fpm
相關文章
相關標籤/搜索