您好,登錄后才能下訂單哦!
安裝必要的工具
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官網下載 wget http://php.net/distributions/php-7.1.2.tar.gz
解壓 tar -zvxf php-7.1.2.tar.gz
進入源碼目錄 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 (這行前面的分號去掉)
(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 (啟動fpm時子進程數量)
listen = 127.0.0.1:9000 (監聽ip和端口 跟nginx 的配置文件里的fastcgi_pass對應上)
user = www-data
group = www-data
(3)
在命令行下執行php或phpize會提示命令找不到,要設置環境變量
export PATH=$PATH:/usr/local/php/bin
(4)
cp ./php.ini-development /usr/local/php/lib
./php -i|grep php.ini 可以查看php.ini在那個哪里目錄下,要把上行配置文件cp到這個目錄下
php-fpm -c /usr/local/php/php.ini 啟動時加載指定php.ini (可以忽略這樣默認就是)
支持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
執行
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 (設置成開機啟動)
/usr/local/php/sbin/php-fpm -c /usr/local/php/etc/php.ini -y /usr/local/php/etc/php-fpm.conf -t (可以忽略這樣默認就是)
killall php-fpm 關閉進程
php-fpm 關閉:
kill -INT 'cat /usr/local/php/var/run/php-fpm.pid'(這個會報錯不知道為什么,pid文件也是存在的)(這個路徑要跟上面php-fpm.conf這個文件設置路徑一樣)
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 (設置成開機啟動)
vi /usr/local/nginx/conf/nginx.conf
#include server/demo.com(可以根據項目include配置不同站點)
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
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。