5

I get on server this errors (CentOs 7):

[proxy:debug] proxy_util.c(2209): [client 80.251.245.153:61902] AH00944: connecting fcgi://127.0.0.1/data/webs/dev/index.php to 127.0.0.1:8000
[proxy:debug] proxy_util.c(2246): [client 80.251.245.153:61902] AH02545: fcgi: has determined UDS as /tmp/php56-fpm.sock
[proxy:debug] proxy_util.c(2418): [client 80.251.245.153:61902] AH00947: connected /data/webs/dev/index.php to httpd-UDS:0
[proxy:error] (2)No such file or directory: AH02454: FCGI: attempt to connect to Unix domain socket /tmp/php56-fpm.sock (*) failed
[proxy_fcgi:error] AH01079: failed to make connection to backend: httpd-UDS
[proxy:debug] proxy_util.c(2171): AH00943: FCGI: has released connection for (*)

Socket Exists, i'm tried change permissions to 777, but not working:

 ls -l /tmp/php56-fpm.sock
-rw-rw----. 1 apache apache 0 Feb 17 16:11 /tmp/php56-fpm.sock

PHP-FPM www.conf listen setting (full file is here: https://pastebin.com/uD5GsMna):

listen=/tmp/php56-fpm.sock

Virtualhost:

<VirtualHost *:80>
   ServerName dev.stavebninyfranek.com
   DocumentRoot "/data/webs/dev"
   <FilesMatch "\.php$">
     SetHandler  "proxy:unix:/tmp/php56-fpm.sock|fcgi://127.0.0.1"
   </FilesMatch> 
 </VirtualHost>

My config files is (httpd.conf): https://pastebin.com/XS6cDuFQ

Im tryed change socket, change permission to apache:apache user, but I dont know where is problem.

Thanks

Pavel Novák
  • 51
  • 1
  • 1
  • 3

6 Answers6

3

This is potentially caused by systemd configuration on Apache, on Centos 7 for example by default the service is configured with :

PrivateTmp=true

Which means it gets its own subdirectory in /tmp visible as /tmp so it can't see files in /tmp added by other programs. The solution would be to not use /tmp for your php-fpm sockets (more secure than setting the above to false).

(I realise that in at least one case a Debian derivative is in use, but it uses systemd too!)

paulie.

Jenny D
  • 27,780
  • 21
  • 75
  • 114
paulie
  • 31
  • 2
1

change user and group to your current apache user

/etc/php-fpm.d/www.conf 

** user and group must be the same in /etc/http/conf/http.conf

Then execute

chown -R user.user /run/php-fpm/www.conf

** change to your user

I believe the above is for centOS, because I am a Debian guy. This is actually one of the solutions for the issue '503 error service unavailable' caused by the php8 sock permission issue. So your sock in apache will be at:

chown -R user.user /var/run/php/php8.1-fpm.sock

Dave M
  • 4,514
  • 22
  • 31
  • 30
1

I just had the same problem after updating apache from 2.4.10 to 2.4.24. With old apache the connection to fcgi worked with a socket in /tmp, while the new apache gave error (2)No such file or directory. Moving the socket to /var/run solved the problem.

Looking at the source code for mod_proxy, I found that on newer apache the path should be relative to the one specified as DefaultRuntimeDir. In my configuration, this is set in /etc/apache2/apache2.conf and it also uses some definition from /etc/apache2/envvars.

eppesuig
  • 313
  • 1
  • 10
0

Make sure the "listen" user and group in your /etc/php/php-fpm.d/www.conf (or a similar location or PHP-FPM pool on your system) is set to match those of your web server:

; Set permissions for unix socket, if one is used. In Linux, read/write
; permissions must be set in order to allow connections from a web server. Many
; BSD-derived systems allow connections regardless of permissions. The owner
; and group can be specified either by name or by their numeric IDs.
; Default Values: user and group are set as the running user
;                 mode is set to 0660
listen.owner = http
listen.group = http
listen.mode = 0660

Depending on your web server and OS these can be http, www-data, httpd, or something else.

pfrenssen
  • 131
  • 2
0

In my case, when changing the PHP version example to PHP7.4 for a specific website in Ispconfig 3.2.2, the webxx.conf file should have been created in /etc/php/7.4/fpm/pool.d/ but instead, it was created at root /.

So for now I just moved the webxx.conf file to /etc/php/7.4/fpm/pool.d/ and restarted PHP7.4-fpm sudo systemctl restart php7.4-fpm and it works correctly.

fboaventura
  • 1,135
  • 11
  • 16
0

I'm solved this problem, When I used

/var/run/php5-fpm.sock

instead of /tmp/ and its working. But why cannot use some another folder instead of /var/run/ ?

Pavel Novák
  • 51
  • 1
  • 1
  • 3
  • There are selinux permissions on that file (indicated by the dot after the permissions). You can see them with `ls -Z`. Most probably the file had the wrong selinux context. – Gerald Schneider Feb 17 '18 at 21:18