PHP-FPM's CentOS boot start script

Source: Internet
Author: User

# set the PHP-FPM as a service and enable the boot to start automatically

# Description: The author has tested only on CentOS7.0 and has not been tested for reliability and stability!

Vi/etc/rc.d/init.d/fpmchmod +x/etc/rc.d/init.d/fpmchkconfig--add fpmchkconfig fpm on


The contents of the/ETC/RC.D/INIT.D/FPM file are as follows:

#! /bin/sh#chkconfig: 2345 60 90## vi /opt/php/etc/php-fpm.conf  # uncomment pid under [global]   #pid  = run/php-fpm.pid## vi /etc/ rc.d/init.d/fpm## chmod +x /etc/rc.d/init.d/fpm## chkconfig --add fpm##  Chkconfig fpm onpath=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bindesc= "php-fpm  Daemon "name=php-fpminstalldir=/opt/phpdaemon= $INSTALLDIR/sbin/$NAMECONFIGFILE = $INSTALLDIR/lib/$ name.confpidfile= $INSTALLDIR/var/run/$NAME. pidscriptname=/etc/init.d/$NAMEset  -e[ -x  "$DAEMON"  ] | |  exit 0do_start ()  {     $DAEMON  -d | |  echo -n  "Php-fpm already running"}do_stop ()  {    kill  -int  ' cat  $PIDFILE '  | |  echo -n  "Php-fpm not running"}do_test ()  {     $DAEMON  - t | |  echo -n  "Php-fpm can ' T test"}case  "$"  in    start)          echo -n  "starting  $DESC:  $NAME"          do_start        echo  "."     ;;     stop)         echo -n  "stopping  $DESC:  $NAME "        do_stop         echo  "."     ;;     restart)         echo -n  "restarting   $DESC:  $NAME "        do_stop         do_start        echo  "."     ;;     test)         echo -n  "testing  $DESC:  $NAME"          do_test        echo  "."     ;;     *)     echo  "usage:  $SCRIPTNAME  {start|stop|restart| Test} " >&2    exit 3    ;; Esacexit 0


Use the following command:

Service FPM StartService fpm stopservice fpm restartservice fpm Test




This article is from the "twists and turns ◇2015" blog, please be sure to keep this source http://huangfuff.blog.51cto.com/2632203/1612655

PHP-FPM's CentOS boot start script

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.