Linux php5.4 startup script and linuxphp5.4 script _ PHP Tutorial

Source: Internet
Author: User
Linux php5.4 startup script and linuxphp5.4 script. Linux php5.4 startup script, linuxphp5.4 script nonsense not much said, directly on step 1, modify the php-fpm.conf configuration file to modify the usrlocalphpetcphp-fpm.conf (of course, this configuration with you Linux php5.4 startup script, linuxphp5.4 script

If you don't talk nonsense, go directly to the next step.
1. modify the php-fpm.conf configuration file
Modify the/usr/local/php/etc/php-fpm.conf (of course this is related to the php path you configured) configuration file

Start pid = run/php-fpm.pid

; Pid file; Note: the default prefix is /usr/local/php/var; Default Value: nonepid = run/php-fpm.pid

Start error_log = log/php-fpm.log

; Error log file; If it's set to "syslog", log is sent to syslogd instead of being written; in a local file.; Note: the default prefix is /usr/local/php/var; Default Value: log/php-fpm.logerror_log = log/php-fpm.log

2. create the/etc/init. d/php file.

root@aliyun:~# cat /etc/init.d/php#!/bin/bash#Author:iranw#E-mail:wang_wenguan#yeah.net#Website:http://www.phpno.com # pid filepid="/usr/local/php/var/run/php-fpm.pid"# php-fpm path&filephpfpm="/usr/local/php/sbin/php-fpm" param=$1 phpnum=`ps -ef | grep php-fpm | wc -l` if [ "$param" = "stop" ]; then    if [ "$phpnum" = "1" ]; then        echo "Php process does not exist."        exit 1    fi    kill `cat $pid`    echo "Close php processes. OK"    exit 1fi if [ "$param" = "start" ]; then    if [ "$phpnum" != "1" ]; then        echo "Php process exist."        exit 1    fi    $phpfpm    echo "Open php processes. OK"    exit 1fi if [ "$param" = "restart" ]; then    if [ "$phpnum" = "1" ]; then        echo "Php process does not exist. Stop Failed."    else        kill `cat $pid`        for i in `ps -ef | grep php-fpm | grep -v grep | awk {'print $2'}`        do            kill -9 $i            echo "Kill $i successed."        done        echo "Close php processes. OK"    fi    $phpfpm    if [ "$phpnum" != "1" ]; then        echo "Open php processes. OK"    else        echo "Open php processes. Failed."    fi    exit 1fi

3. modify permissions

#chmod +x /etc/init.d/php

4. execution result


Linux startup script

Assume that the file name you saved is smple. sh.

Then:
Chmod 755 smple. sh
Then run it directly.
Sh smple. sh
Or
./Smple. sh
Or
Source smple. sh

Which Directory is the linux startup script?

Depends on which Linux release you are using, usually in the/etc/rc. d/etc/init. d Directory

Don't talk nonsense, directly on step 1, modify the php-fpm.conf configuration file modify/usr/local/php/etc/php-fpm.conf (of course this configuration with you...

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.