Blogger Information
Blog 2
fans 0
comment 0
visits 1188
Related recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
php 环境搭建
Benald的博客
Original
552 people have browsed it

1、安装依赖包。

yum -y install libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel MySQL pcre-devel php-mcrypt libmcrypt libmcrypt-devel libmcrypt-devel openssl-devel libcurl-devel libjpeg-turbo-devel mysql-devel
yum -y install curl-devel
yum -y install libxslt-devel

2、PHP 7.0.13下载

cd /usr/lcoal/src/

wget http://cn2.php.net/get/php-7.0.13.tar.gz/from/this/mirror

3、解压

tar -zxvf php-7.0.13.tar.gz

4、编译安装

./configure --prefix=/usr/local/php7 \ --with-curl \ --with-freetype-dir \ --with-gd \
--with-jpeg-dir \ --with-gettext \ --with-iconv-dir \ --with-kerberos \ --with-libdir=lib64 \ --with-libxml-dir \ --with-mysqli \ --with-openssl \ --with-pcre-regex \ --with-pdo-mysql \ --with-pdo-sqlite \ --with-pear \ --with-png-dir \ --with-xmlrpc \ --with-xsl \ --with-zlib \ --enable-fpm \ --enable-bcmath \ --enable-libxml \ --enable-inline-optimization \ --enable-gd-native-ttf \ --enable-mbregex \ --enable-mbstring \ --enable-opcache \ --enable-pcntl \ --enable-shmop \ --enable-soap \ --enable-sockets \ --enable-sysvsem \ --enable-xml \ --enable-zip

make &&  make install

6、拷贝配置文件

cp php.ini-production /usr/local/php7/lib/php.ini
vim /usr/local/php7/lib/php.ini

    修改 php.ini 文件 设置 expose_php = Off
    vim /usr/local/php7/etc/php.ini
    找到 expose_php = On
    改为 expose_php = Off
    

cp /usr/local/php7/etc/php-fpm.conf.default /usr/local/php7/etc/php-fpm.conf

 #把pid 改成 /run/php-fpm.pid

vim /usr/local/php7/etc/php-fpm.conf    
cp /usr/local/php7/etc/php-fpm.d/www.conf.default /usr/local/php7/etc/php-fpm.d/www.conf

 #listen = 127.0.0.1:9000 默认可不改

vim /usr/local/php7/etc/php-fpm.d/www.conf

7、添加服务

vim /etc/systemd/system/php-fpm.service

内容如下


[Unit]
Description=The PHP FastCGI Process Manager
After=syslog.target network.target

[Service]
Type=simple
PIDFile=/run/php-fpm.pid
ExecStart=/usr/local/php7/sbin/php-fpm --nodaemonize --fpm-config /usr/local/php7/etc/php-fpm.conf
ExecReload=/bin/kill -USR2 $MAINPID
ExecStop=/bin/kill -SIGINT $MAINPID

[Install]
WantedBy=multi-user.target

8、启动php-fpm

systemctl start php-fpm.service

9、添加到开机启动

systemctl enable php-fpm.service

 

10、systemctl指令


systemctl enable *.service #开机运行服务
systemctl disable *.service #取消开机运行
systemctl start *.service #启动服务
systemctl stop *.service #停止服务
systemctl restart *.service #重启服务
systemctl reload *.service #重新加载服务配置文件
systemctl status *.service #查询服务运行状态
systemctl --failed #显示启动失败的服务


转自(https://www.cnblogs.com/onephp/p/6093707.html)

Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post