博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
php编译安装加入service
阅读量:6255 次
发布时间:2019-06-22

本文共 2814 字,大约阅读时间需要 9 分钟。

hot3.png

centos6.x

vim /etc/init.d/php

#! /bin/sh### BEGIN INIT INFO# Provides:          php-fpm# Required-Start:    $remote_fs $network# Required-Stop:     $remote_fs $network# Default-Start:     2 3 4 5# Default-Stop:      0 1 6# Short-Description: starts php-fpm# Description:       starts the PHP FastCGI Process Manager daemon### END INIT INFOprefix=/www/server/php/70exec_prefix=${prefix}php_fpm_BIN=${exec_prefix}/sbin/php-fpmphp_fpm_CONF=${prefix}/etc/php-fpm.confphp_fpm_PID=${prefix}/var/run/php-fpm.pidphp_opts="--fpm-config $php_fpm_CONF --pid $php_fpm_PID"wait_for_pid () {	try=0	while test $try -lt 35 ; do		case "$1" in			'created')			if [ -f "$2" ] ; then				try=''				break			fi			;;			'removed')			if [ ! -f "$2" ] ; then				try=''				break			fi			;;		esac		echo -n .		try=`expr $try + 1`		sleep 1	done}case "$1" in	start)		echo -n "Starting php-fpm "		$php_fpm_BIN --daemonize $php_opts		if [ "$?" != 0 ] ; then			echo " failed"			exit 1		fi		wait_for_pid created $php_fpm_PID		if [ -n "$try" ] ; then			echo " failed"			exit 1		else			echo " done"		fi	;;	stop)		echo -n "Gracefully shutting down php-fpm "		if [ ! -r $php_fpm_PID ] ; then			echo "warning, no pid file found - php-fpm is not running ?"			exit 1		fi		kill -QUIT `cat $php_fpm_PID`		wait_for_pid removed $php_fpm_PID		if [ -n "$try" ] ; then			echo " failed. Use force-quit"			exit 1		else			echo " done"		fi	;;	status)		if [ ! -r $php_fpm_PID ] ; then			echo "php-fpm is stopped"			exit 0		fi		PID=`cat $php_fpm_PID`		if ps -p $PID | grep -q $PID; then			echo "php-fpm (pid $PID) is running..."		else			echo "php-fpm dead but pid file exists"		fi	;;	force-quit)		echo -n "Terminating php-fpm "		if [ ! -r $php_fpm_PID ] ; then			echo "warning, no pid file found - php-fpm is not running ?"			exit 1		fi		kill -TERM `cat $php_fpm_PID`		wait_for_pid removed $php_fpm_PID		if [ -n "$try" ] ; then			echo " failed"			exit 1		else			echo " done"		fi	;;	restart)		$0 stop		$0 start	;;	reload)		echo -n "Reload service php-fpm "		if [ ! -r $php_fpm_PID ] ; then			echo "warning, no pid file found - php-fpm is not running ?"			exit 1		fi		kill -USR2 `cat $php_fpm_PID`		echo " done"	;;	configtest)		$php_fpm_BIN -t	;;	*)		echo "Usage: $0 {start|stop|force-quit|restart|reload|status|configtest}"		exit 1	;;esac

chkconfig php on

service php start


centos7.x

vim /usr/lib/systemd/system/php-fpm.service

[Unit]Description=The PHP FastCGI Process ManagerAfter=syslog.target network.target[Service]Type=simplePIDFile=/run/php-fpm.pidExecStart=/usr/local/php7/sbin/php-fpm --nodaemonize --fpm-config /usr/local/php7/etc/php-fpm.confExecReload=/bin/kill -USR2 $MAINPIDExecStop=/bin/kill -SIGINT $MAINPID[Install]WantedBy=multi-user.target

systemctl start php-fpm.service

systemctl enable php-fpm.service

转载于:https://my.oschina.net/zhaojunhui/blog/889217

你可能感兴趣的文章
设计模式-外观模式
查看>>
linux查询文件夹有多少文件数
查看>>
单项链表倒数第k个节点
查看>>
OSChina 周一乱弹 —— 叶良辰到底是谁?
查看>>
OSChina 周三乱弹 —— 可乐帝国军人们,集结了
查看>>
mysql存储过程详解
查看>>
Step by step: Install Ambari
查看>>
自定义线程池有界队列拒绝策略RejectedExecutionHandler
查看>>
struts2实战教程
查看>>
浅谈基类与子类之间继承关系
查看>>
Java 设计模式
查看>>
Filter实现浏览器是否缓存页面信息,和控制编码
查看>>
Windows Server 2012 RemoteApp体验-通过RD Web修改用户密码
查看>>
Nginx笔记
查看>>
运行依赖第三方jar包和本项目的类的scala脚本
查看>>
笔记六 - gen_event
查看>>
MySQL常用命令-自用持续整理
查看>>
ISP IPSEC LAB
查看>>
AD域服务器操作主机五个角色(FSMO)
查看>>
Oracle中快速删除某个用户下的所有表数据
查看>>