您好,登錄后才能下訂單哦!
安裝必要的工具
rpm -qa|grep libxml2 查看下工具是不是有裝
yum list | grep libxml2
yum install libxml2-devel (centos 必須安裝)
ubuntu/debian:
apt-get install libxml2-dev
apt-get install autoconf
//yum install libxml2
yum install libtool
yum install gcc-c++
yum install gcc ( centos 必須安裝)
yum list|grep pcre
yum install pcre-devel
groupadd www-data
useradd -g www-data www-data
----安裝php
php官網(wǎng)下載 wget http://php.net/distributions/php-7.1.2.tar.gz
解壓 tar -zvxf php-7.1.2.tar.gz
進(jìn)入源碼目錄 cd ./php-7.1.2
./configure --prefix=/usr/local/php --enable-fpm --enable-mysqlnd
make
make install
(1)
cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
vi /usr/local/php/etc/php-fpm.conf
pid = run/php-fpm.pid (這行前面的分號(hào)去掉)
(2)
cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf
vi /usr/local/php/etc/php-fpm.d/www.conf
pm.start_servers = 10 (啟動(dòng)fpm時(shí)子進(jìn)程數(shù)量)
listen = 127.0.0.1:9000 (監(jiān)聽(tīng)ip和端口 跟nginx 的配置文件里的fastcgi_pass對(duì)應(yīng)上)
user = www-data
group = www-data
(3)
在命令行下執(zhí)行php或phpize會(huì)提示命令找不到,要設(shè)置環(huán)境變量
export PATH=$PATH:/usr/local/php/bin
(4)
cp ./php.ini-development /usr/local/php/lib
./php -i|grep php.ini 可以查看php.ini在那個(gè)哪里目錄下,要把上行配置文件cp到這個(gè)目錄下
php-fpm -c /usr/local/php/php.ini 啟動(dòng)時(shí)加載指定php.ini (可以忽略這樣默認(rèn)就是)
支持service php-fpm start
cp /home/skinglzw/php-7.2.5/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
vi /etc/init.d/php-fpm
將
php_fpm_BIN=@sbindir@/php-fpm
php_fpm_CONF=@sysconfdir@/php-fpm.conf
php_fpm_PID=@localstatedir@/run/php-fpm.pid
改成
php_fpm_BIN=/usr/local/php/sbin/php-fpm
php_fpm_CONF=/usr/local/php/etc/php-fpm.conf
php_fpm_PID=/usr/local/php/var/run/php-fpm.pid
執(zhí)行
chmod +x /etc/init.d/php-fpm
chkconfig --add php-fpm
chkconfig php-fpm on
echo "/usr/local/php/sbin/php-fpm" >> /etc/rc.local (設(shè)置成開(kāi)機(jī)啟動(dòng))
/usr/local/php/sbin/php-fpm -c /usr/local/php/etc/php.ini -y /usr/local/php/etc/php-fpm.conf -t (可以忽略這樣默認(rèn)就是)
killall php-fpm 關(guān)閉進(jìn)程
php-fpm 關(guān)閉:
kill -INT 'cat /usr/local/php/var/run/php-fpm.pid'(這個(gè)會(huì)報(bào)錯(cuò)不知道為什么,pid文件也是存在的)(這個(gè)路徑要跟上面php-fpm.conf這個(gè)文件設(shè)置路徑一樣)
php-fpm 重啟:
kill -USR2 'cat /usr/local/php/var/run/php-fpm.pid'
----安裝nginx
wget http://nginx.org/download/nginx-1.11.13.tar.gz
tar -zxvf nginx-1.11.13.tar.gz
./configure --prefix=/usr/local/nginx
make
make install
whereis nginx
echo "/usr/local/nginx/sbin/nginx" >> /etc/rc.local (設(shè)置成開(kāi)機(jī)啟動(dòng))
vi /usr/local/nginx/conf/nginx.conf
#include server/demo.com(可以根據(jù)項(xiàng)目include配置不同站點(diǎn))
user www-data;
location / {
root html;
index index.html index.htm index.php;
}
location ~ \.php$ {
root /usr/local/nginx/html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME (代碼路徑)$fastcgi_script_name;
include fastcgi_params;
}
修改完保存,重啟
/usr/local/nginx/sbin/nginx -s restart
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。