Author Topic: PHP-FPM Not Working (503 Service Unavailable)  (Read 51270 times)

0 Members and 1 Guest are viewing this topic.

Offline
*
PHP-FPM Not Working (503 Service Unavailable)
« on: July 04, 2019, 09:58:10 AM »
Hello

When I check "Force Apache to use PHP-FPM Selector, this will disable PHP Selector 2 and PHP Version Switcher." and rebuild configuration the  result on website show 503 Service Unavailable

How to fix it?

Thank you

Offline
**
Re: PHP-FPM Not Working (503 Service Unavailable)
« Reply #1 on: July 04, 2019, 11:17:58 PM »
Is CWPpro running?

Please check the logs of your website from /usr/local/apache/domlogs/

Offline
*
Re: PHP-FPM Not Working (503 Service Unavailable)
« Reply #2 on: July 05, 2019, 02:28:42 PM »
This log from website

Code: [Select]
[Fri Jul 05 09:27:47.128872 2019] [proxy:error] [pid 1729:tid 140330934396672] (2)No such file or directory: AH02454: FCGI: attempt to connect to Unix domain socket /opt/alt/php-fpm73/usr/var/sockets/nontongr.sock (*) failed
[Fri Jul 05 09:27:47.128911 2019] [proxy_fcgi:error] [pid 1729:tid 140330934396672] [client 40.77.167.17:42758] AH01079: failed to make connection to backend: httpd-UDS

Offline
*
Re: PHP-FPM Not Working (503 Service Unavailable)
« Reply #3 on: July 05, 2019, 08:50:45 PM »
webserversw/fpm build logs location
/var/log/cwp/webservers.log
VPS & Dedicated server provider with included FREE Managed support for CWP.
http://www.studio4host.com/

*** Don't allow that your server or website is down, choose hosting provider with included expert managed support for your CWP.

Offline
*
Re: PHP-FPM Not Working (503 Service Unavailable)
« Reply #4 on: July 08, 2019, 08:05:26 AM »
webserversw/fpm build logs location
/var/log/cwp/webservers.log
Code: [Select]
2019-07-08 08:07:50 mydomain.net Running Nginx/Apache/PHP-FPM
2019-07-08 08:07:50 mydomain.net Delete all configuration for domain
2019-07-08 08:07:50 mydomain.net Nginx: SUCCESS conf enabled
2019-07-08 08:07:50 mydomain.net Nginx SSL: SUCCESS conf enabled template: php-fpm/default
2019-07-08 08:07:50 mydomain.net Apache: SUCCESS conf enabled
2019-07-08 08:07:50 mydomain.net Apache SSL: SUCCESS conf enabled template: php-fpm/default
2019-07-08 08:07:50 mydomain PHP-FPM php-fpm73: ERROR failed at quota or security limits
2019-07-08 08:07:50 mydomain PHP-FPM php-fpm73: INFO conf added for nobody user
2019-07-08 08:07:50 PHP-FPM php-fpm73: reload

Still not working until now, I run CWP PRO but I did not find a satisfactory answer to this

Offline
*
Re: PHP-FPM Not Working (503 Service Unavailable)
« Reply #5 on: July 18, 2019, 12:39:09 PM »
Security limits - you can have limit 0 proces, or  if you use multiple servers you can have missconfigured users for nginx, varnish, apache and ports. They not listen each other at default and  ports for nginx and apache are the same, and another problem is that default socket is not configuret per user - you get only 1 for nobody - if you want normal then you need maually add it.
But that is not all - it  not resolve problem with php when choose php-fpm - it still not work. It let you run only html. I have the same problem:
https://forum.centos-webpanel.com/apache/php-not-work-at-nginx-varnish-apache-(php-fpm)/
But i not find reason. I supposed that php-fpm not listen vhost and try another location - but why idk, and where change it also I don't discover.
« Last Edit: July 18, 2019, 01:12:52 PM by skyref »

Offline
*
Re: PHP-FPM Not Working (503 Service Unavailable)
« Reply #6 on: October 07, 2019, 10:49:02 AM »
i have same error

Offline
*
Re: PHP-FPM Not Working (503 Service Unavailable)
« Reply #7 on: October 07, 2019, 11:30:36 AM »
you need to have cwppro for php-fpm selector
VPS & Dedicated server provider with included FREE Managed support for CWP.
http://www.studio4host.com/

*** Don't allow that your server or website is down, choose hosting provider with included expert managed support for your CWP.

Offline
*
Re: PHP-FPM Not Working (503 Service Unavailable)
« Reply #8 on: October 24, 2019, 11:10:18 PM »
I have the same problem.
Some accounts produces 503 error some not.

Problem completely solved after I add more "Process limit" and "Open files" params to account (with "Update Webservers" option).
See /var/log/cwp/webservers.log during that operation for details...

Offline
*
Re: PHP-FPM Not Working (503 Service Unavailable)
« Reply #9 on: September 02, 2020, 03:09:27 PM »
hello

I have the same problem

when I config apache<-varnish<-nginx with php-fpm the website go down (with php-cgi it's ok)

finaly I try two things and now it's working (but I don't know why)

1) in "user accounts -> fix permissions" for user nobody, I fix permissions from 644 to 755 php files (maybe it's not that)

2) I think it's that, after compil all php-fpm in "php setting -> php selector 2" and also "php setting -> php-fpm selector" I compil the php x.x.x
and go back to "webserver setting -> select webserver" check about the good php-fpm for apache and nginx (select the version on down) and select "only apache

click on save & rebuild, check if your website go back, if ok, use a terminal with a "top" command and go back to click on your website to make the user working, here you can see if the user use php-cgi or php-fpm

let's go back to nginx->varnish->apache->php-fpm (check again with "top" command and clicks on your website, if it's all right) you have the best config

if that help you, a thank is good, if you find something else or the "why", say it here


hope that help you

Offline
*
Re: PHP-FPM Not Working (503 Service Unavailable)
« Reply #10 on: September 20, 2020, 09:58:09 AM »
I have the same problem.  Currently all sites are configured with the same php-fpm config, but one isn't working and throws a 503 error.

/opt/alt/php-fpm74/usr/var/sockets does not have a sitename.sock created when php-fpm is started.

I've updated to the latest PHP version, I've rebuilt the config for the affected domain, I've restarted php-fpm, but none of it has caused sitename.sock to be created when php-fpm is stopped and then started.

The site serves a normal html document just fine. 

I'll keep digging, but if someone knows where to look next I'd appreciate the help.

(for those who need to know: yes, I'm running Pro)

UPDATE

This, from /var/log/cwp/webservers.log:

ERROR failed at quota or security limits

None of the site settings or file/directory ownership/permissions were changed for any of the sites for weeks if not months.  I suspect a recent update has bumped into a pre-existing difference for this specific problem site that aren't really there for the others?

Yes, I'll keep digging.  But if anyone knows what to tweak next, please share.
« Last Edit: September 20, 2020, 10:18:18 AM by PeteB »

Offline
*
Re: PHP-FPM Not Working (503 Service Unavailable)
« Reply #11 on: September 20, 2020, 08:12:57 PM »
I fixed it, but I don't know for how long.  To check if you have the same problem

(xx is your php version number, like 74)

1. some sites load fine, some do not, using php-fpm
2. check /opt/alt/php-fpmxx/usr/var/sockets
3. sitename.sock is missing for the site(s) that are giving you the 503 error
4. go to /opt/alt/php-fpmxx/usr/etc/php-fpm.d/users
5. copy the config of a working site for one that isn't. use your internal id for the site
6. go into problemsitename.conf and change all references of the copiedsitename to problemsitename
7. service php-fpmxx stop    then  service php-fpmxx start
8. test the website.  A this stage it worked for me and I considered it fixed

So here's the odd thing
- no idea why problemsitename.conf disappeared and other sites had their .sock files remain
- on restarting php-fpmxx, the .sock file for the problemsite does not get recreated
- changing problem site to php-cgi (it works) and then back to php-fpm does NOT fix the config in as much that it still doesn't create the problemsite.sock file when php-fpmxx is (re)started.  THIS IS THE REAL PROBLEM


Somewhere in the config for problemsite there is a difference that isn't there for workingsite and as such php-fpmxx does not create a .sock file, and as a result you get a 503 error.  If someone can figure out what that problem is, then we may be able to stop this from happening "suddenly" to other sites.

Offline
*
Re: PHP-FPM Not Working (503 Service Unavailable)
« Reply #12 on: December 05, 2020, 04:35:59 PM »
This problem still exists until now with cwpro

Offline
*
Re: PHP-FPM Not Working (503 Service Unavailable)
« Reply #13 on: January 04, 2021, 02:58:19 PM »
Go to cwp dashboard, then click Webserver Settings->WebServers Conf Editor, Select PHP-FPM menu then click on "/opt/alt/php-fpmxx/usr/etc/php-fpm.d/users/"

Now, click on "Add New Conf File" here you will create filename of your user name account, eg username.conf.

Then try using these code into the file:

[account_username]
listen = /opt/alt/php-fpm74/usr/var/sockets/account_username.sock
listen.allowed_clients = 127.0.0.1

;listen.owner = "account_username"
listen.group = "nobody"
listen.mode = 0660
user = "account_username"
group = "account_username"

;request_slowlog_timeout = 15s
;slowlog = /opt/alt/php-fpm74/usr/var/log/php-fpm-slowlog-account_username.log

pm = ondemand
pm.max_children = 4
pm.max_requests = 4000
pm.process_idle_timeout = 15s

;listen.backlog = -1
;request_terminate_timeout = 0s
rlimit_files = 131072
rlimit_core = unlimited
catch_workers_output = yes

env[HOSTNAME] = $HOSTNAME
env[TMP] = /home/account_username/tmp
env[TMPDIR] = /home/account_username/tmp
env[TEMP] = /home/account_username/tmp
env[PATH] = /usr/local/bin:/usr/bin:/bin

Change red word and php-fpm version with yours, after finish restart phpfpm : service php-fpm74 restart

« Last Edit: January 04, 2021, 03:00:29 PM by idugeni »

Offline
*
Re: PHP-FPM Not Working (503 Service Unavailable)
« Reply #14 on: February 02, 2021, 10:41:29 PM »
hello

I have the same problem

when I config apache<-varnish<-nginx with php-fpm the website go down (with php-cgi it's ok)

finaly I try two things and now it's working (but I don't know why)

1) in "user accounts -> fix permissions" for user nobody, I fix permissions from 644 to 755 php files (maybe it's not that)

2) I think it's that, after compil all php-fpm in "php setting -> php selector 2" and also "php setting -> php-fpm selector" I compil the php x.x.x
and go back to "webserver setting -> select webserver" check about the good php-fpm for apache and nginx (select the version on down) and select "only apache

click on save & rebuild, check if your website go back, if ok, use a terminal with a "top" command and go back to click on your website to make the user working, here you can see if the user use php-cgi or php-fpm

let's go back to nginx->varnish->apache->php-fpm (check again with "top" command and clicks on your website, if it's all right) you have the best config

if that help you, a thank is good, if you find something else or the "why", say it here


hope that help you

fafache, step 2 worked like a charm! Thanks.