這個佔用多滲山察少是根據你php-fpm.conf裡面叢茄的配置來的。 pm.min_spare_servers = 8pm.max_spare_servers = 16一般情況是。剛啟動的php-fpm佔用內存是10M,唯戚當過一段時間後會慢慢變成20M左右。 以我這里配置為例,最大情況是16個php-fpm子進程
❷ Linux CentOS安裝PHP多版本同時運行
mkdir -p /lnmp/php74
wget https://www.php.net/distributions/php-7.4.33.tar.gz
tar -zxvf php-7.4.33
cd ./php-7.4.33
./configure --prefix=/lnmp/php74 --enable-fpm --with-mysqli --with-curl --with-pdo_mysql --with-pdo_sqlite --enable-mysqlnd --enable-mbstring --with-gd --with-freetype
(7.4之前的版本freetype是 --with-freetype-dir )
make
make install
cp php.ini-development /lnmp/php74/lib/php.ini
cd /lnmp/php74/etc
mv php-fpm.conf.default php-fpm.conf
mv php-fpm.d/www.conf.default php-fpm.d/www.conf
cd /lnmp/php71/etc/php-fpm.d
vim www.conf
cgi.fix_pathinfo=0
/lnmp/php71/sbin/php-fpm
ps aux|grep php
vim /etc/init.d/php71-fpm
chmod a+x /etc/init.d/php71-fpm
chkconfig --add php71-fpm
service php71-fpm start
service php71-fpm restar
service php71-fpm stop
❸ linux怎麼查看php啟動命令
啟動php-fpm。
/usr/local/php5/sbin/php-fpm /usr/local/php5/為php-fpm的安裝地址。
/usr/local/php-5.6.3/sbin/php-fpm -R # 如果報錯顯示不能用root用戶啟動,則可以考慮使用 -R命令。
查看是否啟動成功:
netstat -lnt | grep 9000
tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN
或者使用如下命令,查看是否9000埠被php-fpm佔用:
netstat -tunpl | grep 9000
tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN 2124/php-fpm。
❹ linux怎麼查看php啟動命令
啟動php-fpm。
/usr/local/php5/sbin/php-fpm /usr/local/php5/為php-fpm的安裝地址。
/usr/local/php-5.6.3/sbin/php-fpm -R # 如果報錯顯示不能用root用戶啟動,則可以考慮使用 -R命令。
查看是否啟動成功:
netstat -lnt | grep 9000
tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN
或者使用如下命令,查看是否9000埠被php-fpm佔用:
netstat -tunpl | grep 9000
tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN 2124/php-fpm。
❺ linux centos7 怎麼重啟php-fpm
/etc/init.d/php-fpmstart
/etc/init.d/php-fpmstop
/etc/init.d/php-fpmrestart
/etc/init.d/php-fpmreload
❻ linuxphp網站怎麼安裝
配置php服務
[[email protected]]cd/usr/local/src
[root@linuxprobesrc]tarzxvfyasm-1.2.0.tar.gz
[root@linuxprobesrc]cdyasm-1.2.0
[[email protected]]./configure
[[email protected]]make
[[email protected]]makeinstall
安裝libmcrypt加密演算法擴展庫(解爛銀圓壓與編譯過程已省略):
[[email protected]]cd/usr/local/src
[root@linuxprobesrc]tarzxvflibmcrypt-2.5.8.tar.gz
[root@linuxprobesrc]cdlibmcrypt-2.5.8
[[email protected]]./configure
[[email protected]]make
[[email protected]]makeinstall
安裝libvpx視頻編碼器(解壓與編譯過程搏旦已省略):
[[email protected]]cd/usr/local/src
[root@linuxprobesrc]tarxjvflibvpx-v1.3.0.tar.bz2
[root@linuxprobesrc]cdlibvpx-v1.3.0
[[email protected]]./configure--prefix=/usr/local/libvpx--enable-shared--enable-vp9
[[email protected]]make
[[email protected]]makeinstall
安裝Tiff標簽圖像文件格式(解壓與編譯過程已省略):
[[email protected]]cd/usr/local/src
[root@linuxprobesrc]tarzxvftiff-4.0.3.tar.gz
[root@linuxprobesrc]cdtiff-4.0.3
[[email protected]]./configure--prefix=/usr/local/tiff--enable-shared
[[email protected]]make
[[email protected]]makeinstall
安裝libpng圖片(png格式)函數庫(解壓與編譯過程已省略):
[[email protected]]cd/usr/local/src
[root@linuxprobesrc]tarzxvflibpng-1.6.12.tar.gz
[root@linuxprobesrc]cdlibpng-1.6.12
[[email protected]]./configure--prefix=/usr/local/libpng--enable-shared
[[email protected]]make
[[email protected]]makeinstall
安裝freetype字體引擎(解壓與編譯過程已省略):
[[email protected]]cd/usr/local/src
[root@linuxprobesrc]tarzxvffreetype-2.5.3.tar.gz
[root@linuxprobesrc]cdfreetype-2.5.3
[[email protected]]./configure--prefix=/usr/local/freetype--enable-shared
[[email protected]]make
[[email protected]]makeinstall
安裝jpeg圖片(jpeg格式)函數庫(解壓與編譯過程已省略):
[[email protected]]cd/usr/local/src
[root@linuxprobesrc]tarzxvfjpegsrc.v9a.tar.gz
[root@linuxprobesrc]cdjpeg-9a
[root@linuxprobejpeg-9a]./configure--prefix=/usr/local/jpeg--enable-shared
[root@linuxprobejpeg-9a]make
[root@linuxprobejpeg-9a]makeinstall
安裝libgd圖像處理程序(解壓與編譯過程已省略):
[root@linuxprobejpeg-9a]cd/usr/local/src
[root@linuxprobesrc]tarzxvflibgd-2.1.0.tar.gz
[root@linuxprobesrc]cdlibgd-2.1.0
[[email protected]]./configure--prefix=/usr/local/libgd--enable-shared--with-jpeg=/usr/local/jpeg--with-png=/usr/local/libpng--with-freetype=/usr/local/freetype--with-fontconfig=/usr/local/freetype--with-xpm=/usr/--with-tiff=/usr/local/tiff--with-vpx=/usr/local/libvpx
[[email protected]]make
[[email protected]]makeinstall
安裝t1lib圖片生成函數庫(解壓與編譯過程已省略):
[[email protected]]cd/usr/local/src
[root@linuxprobesrc]tarzxvft1lib-5.1.2.tar.gz
[root@linuxprobesrc]cdt1lib-5.1.2
[[email protected]]./configure--prefix=/usr/local/t1lib--enable-shared
[[email protected]]make
[[email protected]]makeinstall
將函數庫文件放至合適的位置:
[[email protected]]cd/usr/local/src
[root@linuxprobesrc]ln-s/usr/lib64/libltdl.so/usr/lib/libltdl.so
[root@linuxprobesrc]cp-frp/usr/lib64/libXpm.so*/usr/lib/
安裝php服務程序(命令比較長,請一定要復制完整!!!):
[root@linuxprobesrc]tar-zvxfphp-5.5.14.tar.gz
[root@linuxprobesrc]cdphp-5.5.14
[[email protected]]exportLD_LIBRARY_PATH=/usr/local/libgd/lib
[[email protected]]./configure--prefix=/usr/local/php--with-config-file-path=/usr/local/php/etc--with-mysql=/usr/local/mysql--with-mysqli=/usr/local/mysql/bin/mysql_config--with-mysql-sock=/tmp/mysql.sock--with-pdo-mysql=/usr/local/mysql--with-gd--with-png-dir=/usr/local/libpng--with-jpeg-dir=/usr/local/jpeg--with-freetype-dir=/usr/local/freetype--with-xpm-dir=/usr/--with-vpx-dir=/usr/local/libvpx/--with-zlib-dir=/usr/local/zlib--with-t1lib=/usr/local/t1lib--with-iconv--enable-libxml--enable-xml--enable-bcmath--enable-shmop--enable-sysvsem--enable-inline-optimization--enable-opcache--enable-mbregex--enable-fpm--enable-mbstring--enable-ftp--enable-gd-native-ttf--with-openssl--enable-pcntl--enable-sockets--with-xmlrpc--enable-zip--enable-soap--without-pear--with-gettext--enable-session--with-mcrypt--with-curl--enable-ctype
[[email protected]]make
[[email protected]]makeinstall
復制php服務程序的配置文件到安裝目錄:
[[email protected]]cpphp.ini-proction/usr/local/php/etc/php.ini
刪除默認的php配置文件:
[[email protected]]rm-rf/etc/php.ini
創建php配置文件的軟連接到/etc/目錄中:
[[email protected]]cp/usr/local/php/etc/php-fpm.conf.default/usr/local/php/etc/php-fpm.conf
[[email protected]]ln-s/usr/local/php/etc/php-fpm.conf/etc/php-fpm.conf
[[email protected]]ln-s/usr/local/php/etc/php.ini/etc/php.ini
編輯php服務程序的配置文件:
[[email protected]]vim/usr/local/php/etc/php-fpm.conf
//將第25行參數前面的分號去掉。
pid=run/php-fpm.pid
//修改第148和149行,將user與group修改為www。
user=www
group=www
添加php-fpm服務程序到開機啟動項:
[[email protected]]cpsapi/fpm/init.d.php-fpm/etc/rc.d/init.d/php-fpm
[[email protected]]chmod+x/etc/rc.d/init.d/php-fpm
[[email protected]]chkconfigphp-fpmon
為了保障網站的安全性,禁用掉不安全的功能:
[[email protected]]vim/usr/local/php/etc/php.ini
//修改第305行的disable_functions參數,追加參數為:
disable_functions=passthru,exec,system,chroot,scandir,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,escapeshellcmd,dll,popen,disk_free_space,checkdnsrr,checkdnsrr,getservbyname,getservbyport,disk_total_space,posix_ctermid,posix_get_last_error,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid,posix_getppid,posix_getpwnam,posix_getpwuid,posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_strerror,posix_times,posix_ttyname,posix_uname
配置nginx服務程序支持php:
[[email protected]]vim/usr/local/nginx/conf/nginx.conf
//將第2行前面的號去掉並修改為userwwwwww;
//將第45行參數修改為indexindex.htmlindex.htmindex.php;
//將第65-71行前面的號去掉,修改為:
location~.php${
roothtml;
fastcgi_pass127.0.0.1:9000;
fastcgi_indexindex.php;
fastcgi_paramSCRIPT_FILENAME$document_root$fastcgi_script_name;
includefastcgi_params;
}
重啟nginx與php-fpm服務程序:
[[email protected]]systemctlrestartnginx
[[email protected]]systemctlrestartphp-fpm