Change from php_mod to php-fpm and 503 error sometimes

bartkob

Verified User
Joined
Sep 12, 2007
Messages
27
I've upgraded from mod_php to php-fpm on my backup server, but I see there is error that occurs and disappears:
Code:
==> /var/log/httpd/domains/domain.pl.subdomain.error.log <==
[Wed Apr 12 16:11:27.048963 2023] [proxy:error] [pid 23829:tid 139773159057152] (2)No such file or directory: AH02454: FCGI: attempt to connect to Unix domain socket /usr/local/php74/sockets/username.sock (*:80) failed
[Wed Apr 12 16:11:27.049021 2023] [proxy_fcgi:error] [pid 23829:tid 139773159057152] [client 84.10.xx.xxx:54886] AH01079: failed to make connection to backend: httpd-UDS

What should I do to resolve this issue? I have some custom configs in httpd.conf:
Code:
|?OPEN_BASEDIR_PATH=`HOME`/:/tmp:/var/tmp:/usr/local/lib/php/:/usr/share/file:/usr/share/misc:/usr/share/mime:/mnt/folder/:/mnt/folder`OBDP1``OBDP2`|
|?ALLOW_OVERRIDE=AllowOverride None|

It works like a charm with mod_php, but after changing to php-fpm the is this error that occurs randomly.
Could you tell me what to configure?
 
Last edited:
I have something else from php-fpm74 status:
Code:
kwi 12 16:41:07 194.eu systemd[1]: Starting The PHP FastCGI Process Manager...
kwi 12 16:42:37 194.eu systemd[1]: php-fpm74.service start operation timed out. Terminating.
kwi 12 16:42:37 194.eu systemd[1]: Failed to start The PHP FastCGI Process Manager.
kwi 12 16:42:37 194.eu systemd[1]: Unit php-fpm74.service entered failed state.
kwi 12 16:42:37 194.eu systemd[1]: php-fpm74.service failed.
 
could you show us log message
Code:
service php-fpm74 start
service php-fpm74 status -l
journalctl -u php-fpm74
free -h

it hard to tracking bug issued. Could you remove your custom config and testing it around 6-12 Hr.?

maybe it cause by your OPEN_BASEDIR_PATH that some path don't have permission to read. Because php-fpm need correct permission ( admin:admin or 0770 for share folder ) to read.

Also try to check "ALLOW_OVERRIDE", because php-fpm doesn't support directive value. so it not need it.

if you can't remove your custom open_basedir, maybe trying to remove "ALLOW_OVERRIDE". first and debug it.
 
Last edited:
Your php-fpm74 service isn't starting.

There won't be any FPM sockets available for Apache to connect to to handle PHP if the service is not running.

You would need to diagnose the issue from

systemctl status php-fpm74
 
I've removed OPEN_BASEDIR_PATH custom config.

When the error occured (19:40 time) there were such errors:
Code:
journalctl -u php-fpm74:

kwi 12 19:38:24 194.eu systemd[1]: php-fpm74.service start operation timed out. Terminating.
kwi 12 19:38:24 194.eu systemd[1]: Unit php-fpm74.service entered failed state.
kwi 12 19:38:24 194.eu systemd[1]: php-fpm74.service failed.
kwi 12 19:38:53 194.eu systemd[1]: Unit php-fpm74.service cannot be reloaded because it is inactive.
kwi 12 19:38:53 194.eu systemd[1]: Starting The PHP FastCGI Process Manager...
kwi 12 19:40:23 194.eu systemd[1]: php-fpm74.service start operation timed out. Terminating.
kwi 12 19:40:23 194.eu systemd[1]: Failed to start The PHP FastCGI Process Manager.
kwi 12 19:40:23 194.eu systemd[1]: Unit php-fpm74.service entered failed state.
kwi 12 19:40:23 194.eu systemd[1]: php-fpm74.service failed.
kwi 12 19:40:28 194.eu systemd[1]: Starting The PHP FastCGI Process Manager...

Code:
● php-fpm74.service - The PHP FastCGI Process Manager
   Loaded: loaded (/etc/systemd/system/php-fpm74.service; enabled; vendor preset: disabled)
   Active: failed (Result: timeout) since śro 2023-04-12 19:45:58 CEST; 6s ago
  Process: 25365 ExecStart=/usr/local/php74/sbin/php-fpm74 --nodaemonize --pid=/run/php-fpm74.pid (code=exited, status=0/SUCCESS)
 Main PID: 25365 (code=exited, status=0/SUCCESS)

kwi 12 19:44:28 194.eu systemd[1]: Starting The PHP FastCGI Process Manager...
kwi 12 19:45:58 194.eu systemd[1]: php-fpm74.service start operation timed out. Terminating.
kwi 12 19:45:58 194.eu systemd[1]: Failed to start The PHP FastCGI Process Manager.
kwi 12 19:45:58 194.eu systemd[1]: Unit php-fpm74.service entered failed state.
kwi 12 19:45:58 194.eu systemd[1]: php-fpm74.service failed.

after about minute php-fpm was restarted by DA and start working again
 
no any error relate, maybe you don't have enought memory.
Code:
free -m
 
I'm not clear on what is working and what isn't working.

The status message is showing that the php-fpm74 service is not starting because it's timing out.

You would have to determine why it is timing out.

How many user conf files do you have in /usr/local/php74/etc/php-fpm.d for it to load?

ls -al /usr/local/php74/etc/php-fpm.d/*.conf | wc -l

There's not enough information here to determine why it is timing out.
 
Code:
[root@ns3115177 custombuild]# free -m
              total        used        free      shared  buff/cache   available
Mem:          31868        1173         301       13207       30393       17041
Swap:          1021        1021

On the server there is PostgreSQL that uses lots of memory, but mostly cache.

How many user conf files do you have in /usr/local/php74/etc/php-fpm.d for it to load?
Only default file. I have only two users on my server.


I don't see any message that show me the exact problem. Only logs are from apache log files:

Code:
[Wed Apr 12 19:45:59.156439 2023] [proxy:error] [pid 23518:tid 140419257956096] (2)No such file or directory: AH02454: FCGI: attempt to connect to Unix domain socket /usr/local/php74/sockets/username.sock (*:80) failed
[Wed Apr 12 19:45:59.156496 2023] [proxy_fcgi:error] [pid 23518:tid 140419257956096] [client xx.xx.xx.xxx4:55610] AH01079: failed to make connection to backend: httpd-UDS, referer: https://domain.com

EDIT:
I've stopped PostgreSQL. There was 12GB free memory, but the error still ocuured after ~10 pageviews.
 
look like memory not enought. You can see it from swap partition, it use fully 1021mb and memory free only 300mb.

Nomally php-fpm required memory around 500-600mb on normal state, and when full impack load from ddos attack. it will go upper to 1gb+.
 
EDIT:
I've stopped PostgreSQL. There was 12GB free memory, but the error still ocuured after ~10 pageviews.
in this case, maybe something wrong with your server, try reboot your server.
If issued still can't solve, create ticket and let DA team fix your issued.

Because all logs that you provide to us not have anything weird, except "start operation timed out". so your server have something problem that block php-fpm from starting process.
 
I've added
--with-fpm-systemd \
to php configuration and rebuild php

After that the problem was solved completely.
 
I've added
--with-fpm-systemd \
to php configuration and rebuild php

After that the problem was solved completely.
Indeed. Not having that will cause systemd to timeout when restarting.

Strange though that this isn't included already in the custombuild profile for PHP.
 
Back
Top