PHP-FPM cannot start after server restarts unexpectedly

Source: Internet
Author: User
Keywords Servers Linux

Intermediary transaction http://www.aliyun.com/zixun/aggregation/6858.html ">seo diagnose Taobao guest cloud host technology Hall

Monday is a new beginning! Everything is going according to the usual rhythm, orderly. The first is to check the site and the application system is normal, and then look at the log information is also strange, a lap down the results of the same as before no other problems.

Today, but no like to the same, after the line did not open the system monitoring (usually with SECURECRT login system, open top command Let it has been online, occasionally look at). At 10 o ' Day in the morning, 11 o ' time, and then clicked on the site, which appeared to me for one of the wake (not a surprise)

  

The original text is: An error occurred.

Sorry,the page you are are looking for is currently unavailable.

Please try recycle later.

If you arre the system administrator's this resource then your should check the error log for details.

The interface is really rare, but similar to this is the front and back end connection timeout will also appear a prompt page, but the content is not the same. I'm in a hurry, is it dark? Because recently a friend said his site was Hung horse, so I rushed to the idea is to be black. Quickly SSH login backstage look, the last login IP is also their own, this is a little bit relieved that they are too nervous.

After a little calm, and then combined with the message of the hint page, it should be the system services out of the problem rather than be caused by intrusion. So from the check log, process, port and so on to start the investigation, soon in the Php-fpm.log log files have found that almost all the same information, as follows:

Connect () failed (111:connection refused) while connecting to upstream

upstream:fastcgi://127.0.0.1:9000

From this line it is clear it isn't listening to port 9000. Or its listen the queue is full.

And then check the PHP-FPM process and 9000 port, i le a go ~ No process (naturally there is no port), in the end what is going on? I installed the time clearly has joined the boot PHP-FPM service, how can not actually get up now? Simply start by hand:

#www. free920.com

#services php-fpm start came back and actually prompted to run

PHP-FPM already running ...

#services php-fpm Stop

stopping php-fpm: [FAILED]

Prompt failed!!!!

I again according to log information asked excessive Niang, she said that appear such a hint should be log more than 2G caused, to solve this problem to adjust the relevant parameters, the Log_level from notice to error, only to record the wrong level of information.

Soon find php-fpm.conf file and make the corresponding modification (but I immediately feel that there is a problem: just check the log, the log is not 1M, distance from 2G is still very far, so it is not the problem), but still modify it, anyway, no other impact. But found here, the heart can not help but nervous. Then remembered to ask operators, is not what they have done, this just learned that an hour ago they restarted the machine, combined with just started the service and stop the service when the prompt information, a said PHP-FPM has been running, a said that can not terminate the service.

Suddenly seem to think of what, to check the PID file, because in Linux to record whether a process is running by generating a corresponding PID file, write the current process number for identification. What a joy! ~ This PID file is empty, although there is a file with this name, but there is no content inside. So it explains why the start service says it's running, and when it stops, it says it failed. After checking, found that the script used to start PHP-FPM is not strict, only when the start of the check whether there is a PID file, regardless of whether it has a true PID content, it caused the start, stop is not normal.

Solution:

Add a check to the PID document before starting the instruction, and delete the file if it is empty so that the service can start normally.

If [!-s $php _fpm_pid]; Then

Rm-f $php _fpm_pid

Fi

$php _fpm_pid is a file that points to the PHP-FPM record process number, defined in front of the PHP-FPM startup script, and details are presented in the next article. My encounter is because the server accidentally restarted, resulting in the Php-fpm.pid file is empty (why there is an empty file has yet to be verified).

This is the first day of this week to encounter a small episode ~ Although not a big impact, but once again the test of their ability to work under these circumstances, I hope this article can also help other webmaster: In the discovery of the problem after the calm, and carefully read the relevant information, do not understand the meaning of the place can ask Niang or dog brother, To the possible problems of the place, in solving the problem at the same time also improved the relevant knowledge!!

Information provided: 920 cinemas (http://www.free920.com), Welcome to reprint, and indicate the source, thank 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.