Reputation: 99
I have such virtual host settings
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
<FilesMatch \.php$>
SetHandler "proxy:unix:/var/run/php/php5.6-fpm.sock|fcgi://localhost/"
</FilesMatch>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
phpinfo() shows that my site has a version of php 5.6. All right!
Now I am trying to restrict the rights with Mod_Ruid2. I added the following to my virtual host
RDocumentChRoot /var /www/html
<Directory "/www/html/">
Require all granted
RMode config
RUidGid admin0 admin0
</Directory>
after trying to get to the site I see an error in the logs
[Sun Oct 13 16:09:02.492117 2019] [proxy:error] [pid 13571] (2)No such file or directory: AH02454: FCGI: attempt to connect to Unix domain socket /var/run/php/php5.6-fpm.sock (*) failed
[Sun Oct 13 16:09:02.492194 2019] [proxy_fcgi:error] [pid 13571] [client 192.168.0.110:47622] AH01079: failed to make connection to backend: httpd-UDS
Tell me, what am I doing wrong?
Upvotes: 9
Views: 42135
Reputation: 56
To run php scripts under php5.4-fpm, You must install php5.4-fpm .
On Ubuntu 22.04 its posible with:
sudo apt install php5.6 php5.6-fpm -y
Upvotes: 1
Reputation: 685
Please note I had this come up today and I found the solution on serverfault. pfrenssen's answer specifically. Note the field name tripped me up for an hour as listen.group
and group
both exist. I then needed to comment a line listen.acl_users
out which was uncommented by default. It important to note that the www-data
user I am using is the user I have predefined (non-default) apache user. I believe this to be the underlying cause. Below is my one liner to change these values. Use cp /etc/php-fpm.d/www.conf /etc/php-fpm.d/www.conf.default
first to help test as sed modifies the file in place.
sed -i -e 's/user = apache/user = www-data/g' \
-e 's/group = apache/group = www-data/g' \
-e 's/;listen.owner = nobody/listen.owner = www-data/g' \
-e 's/;listen.group = nobody/listen.group = www-data/g' \
-e 's/;listen.mode = 0660/listen.mode = 0660/g' \
-e 's/listen.acl_users = apache,nginx/;listen.acl_users = apache,nginx/g' /etc/php-fpm.d/www.conf
Upvotes: 0
Reputation: 1137
I've just faced the same issue, I commented this part of code in my drupal.con (could be another one for you)
#<FilesMatch \.php$>
# SetHandler proxy:unix:/run/php-fpm/www.sock|fcgi://localhost/
#</FilesMatch>
And the website just show up. Apparently I did not need it on this serveur (redhat 7), but I needed it in my CentOS for the same project.
Upvotes: 0
Reputation: 391
I faced the same issue, in my case I could fix it by restarting PHP fpm service, by running code:
sudo service phpx.x-fpm restart
OS: centos Webserver: nginx
Upvotes: 6
Reputation: 1497
i had same issue on CentOS 8
and Apache 2.4.37
and after many hour research in internet , i can't found any solution for unix domain proxy.
i don't know this is a bug or bad document?
for resolve this problem only you must be replace proxy:unix:/YOUR_PATH
with proxy:unix://YOUR_PATH
.
<FilesMatch \.php$>
SetHandler "proxy:unix:///var/run/php/php5.6-fpm.sock|fcgi://localhost/"
</FilesMatch>
notice : ...|fcgi://localhost/
must be exists.
after your change this setting the new problem appears :
File not found.
this error is good because we were able connected to php-fpm
from apache
.
i think this problem is bug. please see this link.
https://bugs.php.net/bug.php?id=55322
for resolve this problem you must be implement this structure :
httpd.conf
<VirtualHost *:80>
ServerName www.example.com
DocumentRoot /var/www/example.com/public_html
#your configs ....
</VirtualHost>
/etc/php-fpm.d/example.com.conf
[example.com]
;your configs...
chroot = /
access.log = /var/www/$pool/logs/phpfpm-access-$pool.log
php_admin_value[open_basedir] = /var/www/$pool/public_html
;your configs...
Upvotes: 1
Reputation: 161
I've just faced the same issue while trying to run apache(2.4) + php(7.2) over CentOS 8.
[Thu Jan 09 06:59:10.420499 2020] [proxy:error] [pid 121:tid 139846433412864] (2)No such file or directory: AH02454: FCGI: attempt to connect to Unix domain socket /run/php-fpm/www.sock (*) failed
[Thu Jan 09 06:59:10.420535 2020] [proxy_fcgi:error] [pid 121:tid 139846433412864] [client 127.0.0.1:55580] AH01079: failed to make connection to backend: httpd-UDS
To solve this, I had to launch a service called "php-fpm" (sudo systemctl enable --now php-fpm), that led me to another error:
[09-Jan-2020 07:07:09] ERROR: unable to bind listening socket for address '/run/php-fpm/www.sock': No such file or directory (2)
[09-Jan-2020 07:07:09] ERROR: FPM initialization failed
That was caused by the folder /run/php-fpm not existing.
mkdir -p /run/php-fpm/
After that, just launched again php-fpm, this time without errors and apache+php worked like a charm.
Note that there is a small difference between your error and mine, the paths are a bit different. Instead of "/run/php-fpm/" you should create "/var/run/php/".
Hope this helps
Upvotes: 10