- Saved searches
- Use saved searches to filter your results more quickly
- php-fpm fails to restart from VestaCP #1286
- php-fpm fails to restart from VestaCP #1286
- Comments
- Operating System (OS/VERSION):
- VestaCP Version:
- Installed Software (what you got with the installer):
- Steps to Reproduce:
- Related Issues/Forum Threads:
- Other Notes:
- For those still having this problem.
- How can I find out why my php5-fpm failed to start?
- 6 Answers 6
- Phpfpm Failed to start : How to get rid off this?
- Why Phpfpm Failed to start error occurs?
- How we resolve the problem?
- Too many requests
- Altering configuration file
- Conclusion
- PREVENT YOUR SERVER FROM CRASHING!
Saved searches
Use saved searches to filter your results more quickly
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
php-fpm fails to restart from VestaCP #1286
php-fpm fails to restart from VestaCP #1286
Comments
Operating System (OS/VERSION):
VestaCP Version:
Installed Software (what you got with the installer):
Steps to Reproduce:
https:/my.ip.address/8083/edit/server/php-fpm > Save (and restart PHP-FPM)
Related Issues/Forum Threads:
Other Notes:
Error: php-fpm7.0 failed to start with new config
There are two php*-fpm scripts in /etc/init.d/, so it is unable to restart from the GUI.
The text was updated successfully, but these errors were encountered:
Wonder if this would work better for people who have multiple php*-fpm on their system?
# restart any *running* php fpm found with ps uaxw # otherwise, simply use: # find /etc/init.d/ -name 'php*-fpm*' -type f -exec basename <> \; | xargs -I<> service <> restart || true phpfpms="5.6:7.0:7.1:7.2:8.0" set -f # avoid globbing (expansion of *). iphpfpm=($//:/ >) for i in "$!iphpfpm[@]>" do if ps auxw | grep php/$ /fpm | grep -v grep > /dev/null then service php$ -fpm restart || true fi done
@klou , You should just specify name of the service which controls php-fpm process in /usr/local/vesta/bin/v-change-sys-service-config script at 98th row, not binary filename.
For example, replace php-fpm7.1 (or more complicated statement, like =$(ls /usr/sbin/php*fpm* |cut -f 4 -d /) ) with just php-fpm And it works well for me.
My excerpt from the script mentioned above
if [ "$service" = 'php' ]; then if [ "$WEB_SYSTEM" = "nginx" ]; then service="php-fpm" else service=$WEB_SYSTEM fi fi
I’ve started getting the same error on my server when adding a new domain. I get the error as a popup, but then when I press «add» again, it works! As far as I can see it seems to restart the 2nd time around. Not sure if it’s related? (I never used to get that error come up when adding a new domain)
I’ve started getting the same error on my server when adding a new domain. I get the error as a popup, but then when I press «add» again, it works! As far as I can see it seems to restart the 2nd time around. Not sure if it’s related? (I never used to get that error come up when adding a new domain)
I’ve started getting the same error on my server when adding a new domain. I get the error as a popup, but then when I press «add» again, it works! As far as I can see it seems to restart the 2nd time around. Not sure if it’s related? (I never used to get that error come up when adding a new domain)
I also have the same issues
Workaround, which Pleskan suggested worked forked for me on Ubuntu 16.04.3
The thing is when I run
/etc/init.d/php7.0-fpm status
it shows that service is dead
Everything is ok, when I run
/etc/init.d/php-fpm status
I believe this work the best:
In case systemd is present (php-fpm is then not in /etc/init.d/) it’ll find the service(s) name.
In case they are multiple php-fpms present (per @dpeca suggestion), it’ll restart each of them.
I urge maintainers to review and accept my FIX as this is annoying, having fixes, not having anyone to review/contribute and push them.
@serghey-rodin
Already fixed. Can’t reproduce on Ubuntu 16.04 with php 7.0
@anton-reutov This bug may be fixed on ubuntu, but is still present on CentOS 7.X versions
reopen the issue.
I installed vestacp today. I am having this issue with Ubuntu 18.04 version as well with the nginx + php-fpm +mysql config.
For those still having this problem.
When i upgrade my php from 7.2 to 7.4 in Ubuntu 18.04LTS i had this issue from time to time of Error: php-fpm restart failed when adding a new domain . When i did the second one it worked. I decided to dig the content of /etc/init.d/php-fpm and found this:
#!/bin/sh ### BEGIN INIT INFO # Provides: php7.2-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 php7.2-fpm # Description: Starts The PHP FastCGI Process Manager Daemon ### END INIT INFO # Author: Ondrej Sury PATH=/sbin:/usr/sbin:/bin:/usr/bin DESC="PHP 7.2 FastCGI Process Manager" NAME=php-fpm7.2 CONFFILE=/etc/php/7.2/fpm/php-fpm.conf DAEMON=/usr/sbin/$NAME . rest of the code
This meant php7.2-fpm which i had uninstalled was being restarted instead of php7.4-fpm. I zipped it up zip php-fpm-bak.zip php-fpm as a backup and deleted it rm php-fpm . you must have root rights. Then i copied fpm7.4-fpm file to be php-fpm by: cp php7.4-fpm php-fpm . Alternatively instead of coping you can do a symbolic link like this: ln -s /etc/init.d/php7.4-fpm /etc/init.d/php-fpm . I wanted some to understand why the error instead just saying do a symbolic link. So far my Vesta CP is working as expected.
Same as above there is another symbolic link you need to create. For example if you have updated to php7.4, here is how to update the ln ln -s /lib/systemd/system/php7.4-fpm.service /lib/systemd/system/php-fpm.service
Guys let us know if it helped
How can I find out why my php5-fpm failed to start?
I get 504 gateway timeout when I try to reach my server. A small check didn’t find any logs on php5-fpm logs, but just to make sure, I tried to restart it. When I am trying to restart it:
sudo service php5-fpm restart
sudo service php5-fpm stop sudo service php5-fpm start
6 Answers 6
Did you check your error_log file for php-fpm? Location of that file should be declared in your php-fpm.conf (in Ubuntu config is /etc/php5/fpm/php-fpm.conf, log file is /var/log/php5-fpm/log), also check your log_level, if is disabled (;log_level), please enable it and change it to the debug. After that try restart php5-fpm service and check your logs.
You can also try to run php5-fpm in foreground mode:
# php5-fpm -y /etc/php5/fpm/php-fpm.conf
Maybe this show you something interesting.
Davis, it seems to work for me +1! But.. jamzed gave me the solution, I found some error +1! thank you all!
If you start FPM using an upstart job, then the php-fpm startup logs will be written to /var/log/upstart/
Standard troubleshooting procedure:
- Check the log file. If you don’t know where it is check the config or to figure out for certain find the pid with ps aux | grep php-fpm , then do lsof -p $PID | grep log (omit the grep if it shows nothing).
- 99% of the time log files will show you the cause. If not, look for a logging level in the config, raise it and try again.
- Perhaps it quits instantly and you can’t get the PID to inspect the process. You can also try starting the process in the foreground, but this means figuring out which commandline switches you need to use. Usually you just need to point it at your existing config.
- If neither the log file or stdout/stderr (foreground output) contain include any clues it’s time for strace. but that’s another post.
In my case, updating to nginx > 1.6.1 the parameters that are passed to php5-fpm are located in fastcgi.conf instead of in fastcgi_params, resulting in a PHP that always returns 200 (ok), but never any content, because the SCRIPT_FILENAME was no longer set.
I hope it also helps someone else.
For me, the problem was my php-fpm.conf file was not using the default config filename — it was named /etc/php5/fpm/php5-fpm.conf ( php5-fpm.conf vs php-fpm.conf )
php5-fpm -t [26-Jul-2014 22:39:16] ERROR: failed to open configuration file '/etc/php5/fpm/php-fpm.conf': No such file or directory (2) [26-Jul-2014 22:39:16] ERROR: failed to load configuration file '/etc/php5/fpm/php-fpm.conf' [26-Jul-2014 22:39:16] ERROR: FPM initialization failed
I renamed the conf file to php-fpm.conf and that fixed the problem.
sudo mv /etc/php5/fpm/php5-fpm.conf /etc/php5/fpm/php-fpm.conf sudo service php5-fpm restart * Restarting PHP5 FastCGI Process Manager php5-fpm [ OK ]
Phpfpm Failed to start : How to get rid off this?
PHP-FPM is a daemon especially useful for sites of any size, especially busier sites.
Often we face error Phpfpm Failed to start, which can be due to various reasons mainly too many requests of PHP services.
At Bobcares, we often get requests from our customers to fix errors related to Phpfpm as part of our Server Management Services.
Today, let’s get into the details on how our Support Engineers help our customers to fix this error.
Why Phpfpm Failed to start error occurs?
Now, let’s discuss why this error occurs.
When a web server has a request, the Fast CGI forward this to PHP-FPM service. Thereafter, PHP-FPM then compiles and executes the PHP script, and output back to the web server.
Then PHP-FPM waits for the next request and this process continues. This way of processing PHP scripts provide higher processing performance. In effect, it expedites the website loading.
Sometimes the PHP-FPM will fail to start and stops its service which leads to disturbance in the working of the website.
The error occurs, due to the too much request for the PHP-FPM in the server.
For instance, the error appears as follows:
Let’s see in detail how our Support Engineers fix this error.
How we resolve the problem?
At Bobcares, where we have more than a decade of expertise in managing servers, we see many customers face error Phpfpm Failed to start.
Now, let’s see how our Support Engineers fix this error.
Too many requests
Recently, one of our customers approached us with the error ‘Phpfpm Failed to start‘.
We initially checked the processes running in the server and its load through top command.
After analysis, we traced the PID of the PHP-FPM service and then killed the php-fpm process.
After killing all process ID(pid) of PHP-FPM, we then restarted Apache service.
Thereafter, restarting the service, we could trace the PHP-FPM problem as resolved.
Altering configuration file
Recently, another customer encountered PHP-FPM failed error during a fresh installation of PHP-FPM. On further investigation, we traced that the error occurred as a result of the mistake in the php-fpm.conf file.
We identified that in the new installation the pid file directive was commented in the php-fpm.conf file. Thereafter, we removed the ‘;’ to write the pid file.
After removing this start command didn’t have problems locating the pid file in the default location.
[Having trouble with error Phpfpm Failed to start? We’ll fix it for you.]
Conclusion
In short, PHP-FPM service is very useful for sites of any size, especially busier sites. The Phpfpm Failed to start problem can be easily identified and rectified. Today, we saw how our Support Engineers fix this error.
PREVENT YOUR SERVER FROM CRASHING!
Never again lose customers to poor server speed! Let us help you.
Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.