Linux under php5.4 startup script _php Tips

Source: Internet
Author: User

Nonsense not much to say that directly on the steps
1, modify the php-fpm.conf configuration file
Modify/usr/local/php/etc/php-fpm.conf (of course this is related to your PHP path) configuration file

Start Pid=run/php-fpm.pid

; Pid file
; note:the default prefix Is/usr/local/php/var
; Default value:none
pid = run/php-fpm.pid

Start Error_log=log/php-fpm.log

; Error log file
; If it ' s set to "Syslog", the log is sent to Syslogd instead of being written
;
note:the default prefix Is/usr/local/php/var
; Default value:log/php-fpm.log
error_log = Log/php-fpm.log

2. Create/etc/init.d/php files

root@aliyun:~# cat/etc/init.d/php #!/bin/bash #Author: iranw #E-mail:wang_wenguan#yeah.net #Website: http:// www.phpno.com # pid file pid= "/usr/local/php/var/run/php-fpm.pid" # php-fpm path&file phpfpm= "/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 1 fi If [" $param "=" Start "]; Then if ["$phpnum"!= "1"];
        Then echo "PHP process exist." Exit 1 fi $phpfpm echo "Open PHP processes. OK "Exit 1 fi 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 $ '} ' 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 1 fi

3, modify the permissions

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

4. Implementation results

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.