LNMP配置 PHP安裝

2022-06-25 02:24:11 字數 2165 閱讀 6695

#cd /usr/local/src  

//軟體包都放在這裡方便管理

#wget

二、解壓

#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多個程序

LNMP之編譯安裝PHP

前段引用 中間再設定php配置時可能出現 在linux上編譯安裝php時,為什麼沒有php fpm.conf.default這個檔案 cp php.ini production usr local php.ini 此路徑由編譯時 with config file path usr local 決定 ...

lnmp架構下PHP安全配置

1.使用open basedir限制虛擬主機跨目錄訪問 限制php在指定的目錄裡活動 2.禁用不安全php函式 disable functions show source,system,shell exec,passthru,exec,popen,proc open,proc get status,...

LNMP搭建的PHP安裝方法

cd usr local src tar zxvf php 5.6.30.tar.gz 解壓php的原始碼包 cd php 5.6.30 useradd s sbin nologin php fpm 建立使用者 configure prefix usr local php fpm with conf...