标签:mirror path 依赖 ESS read rip ros 修改 模块
Linux版本:64位CentOS 6.6
Nginx版本:nginx1.8.0
php版本:php-7.0.2
(一)下载 (php-7.1.18.tar.gz: http://cn2.php.net/get/php-7.1.18.tar.gz/from/this/mirror)
# wget http://php.net/get/php-7.0.2.tar.gz/from/a/mirror
建议安装之前先看看安装帮助文件INSTALL
(二)解压安装
# tar zxvf php-7.0.2.tar.gz
# cd php-7.0.2
(三)首先查看安装帮助
# ./configure --help
./configure --prefix=/usr/local/php \
--with-curl \
--with-freetype-dir \
--with-gd \
--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
如果配置错误,需要安装需要的模块,直接yum一并安装依赖库
# yum -y install libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel mysql pcre-devel
注意:安装php7beta3的时候有几处配置不过去,需要yum一下,现在php-7.0 .2已经不用这样了。
# yum -y install curl-devel
# yum -y install libxslt-devel
(四)编译安装
# make && make install
(五)配置文件
# cp php.ini-development /usr/local/php/lib/php.ini
# cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
# cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf
# cp -R ./sapi/fpm/php-fpm /etc/init.d/php-fpm
vi /usr/local/php/etc/php-fpm.d/www.conf
group =www
user=www
需要注意的是php7中www.conf这个配置文件配置phpfpm的端口号等信息,如果你修改默认的9000端口号需在这里改,再改nginx的配置
启动
# /etc/init.d/php-fpm
查看phpinfo()
(六)、php-fpm开机启动
1、在/etc/init.d/目录下创建脚本
vi /etc/init.d/php-fpm
2、更改脚本权限
chown -R www:www /etc/init.d/php-fpm
3、编写脚本内容
#!/bin/sh
# php-fpm - this script starts and stops the php-fpm daemin
# chkconfig: - 85 15
# processname: php-fpm
# config: /usr/local/php/etc/php-fpm.conf
set -e
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DESC="php-fpm daemon"
NAME=php-fpm
DAEMON=/usr/local/php/sbin/$NAME #这里设成自己的目录
CONFIGFILE=/usr/local/php/etc/php-fpm.conf #这里设成自己的目录
PIDFILE=/usr/local/php/var/run/$NAME.pid #这里设成自己的目录(vi php-fpm.conf 去掉里面那个 pid = run/php-fpm.pid 前面的分号然后再启动php-fpm才能自动生成的)
SCRIPTNAME=/etc/init.d/$NAME #这里设成自己的目录
# If the daemon file is not found, terminate the script.
test -x $DAEMON || exit 0
d_start(){
$DAEMON -y $CONFIGFILE || echo -n " already running"
}
d_stop(){
kill -QUIT `cat $PIDFILE` || echo -n " no running"
}
d_reload(){
kill -HUP `cat $PIDFILE` || echo -n " could not reload"
}
case "$1" in
start)
echo -n "Starting $DESC: $NAME"
d_start
echo "."
;;
stop)
echo -n "Stopping $DESC: $NAME"
d_stop
echo "."
;;
reload)
echo -n "Reloading $DESC configuration..."
d_reload
echo "Reloaded."
;;
restart)
echo -n "Restarting $DESC: $NAME"
d_stop
# Sleep for two seconds before starting again, this should give the nginx daemon some time to perform a graceful stop
sleep 2
d_start
echo "."
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload)" >&2
exit 3
;;
esac
4、设置开机启动
#chkconfig php-fpm on
标签:mirror path 依赖 ESS read rip ros 修改 模块
原文地址:https://www.cnblogs.com/buxin111/p/12522903.html