您好,登录后才能下订单哦!
安装必要的工具
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进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。