Welcome! Log In Create A New Profile

Advanced

php8.2-fpm permission denied

Posted by Jeremy Ardley 
php8.2-fpm permission denied
January 23, 2023 09:45PM
I have upgraded an existing php-fpm 7.4 installation to 8.2. I don't have problems using 7.4
I am using www-data as user in both nginx and php8.2.fpm
I am using socket connection between services
I am not running selinux

nginx.conf:

user www-data;

site config:

location ~ '\.php$|^/update.php' {
fastcgi_split_path_info ^(.+?\.php)(|/.*)$;
# Ensure the php file exists. Mitigates CVE-2019-11043
try_files $fastcgi_script_name =404;
# Security note: If you're running a version of PHP older than the
# latest 5.3, you should have "cgi.fix_pathinfo = 0;" in php.ini.
# See http://serverfault.com/q/627903/94922 for details.
include fastcgi_params;
# Block httpoxy attacks. See https://httpoxy.org/.
fastcgi_param HTTP_PROXY "";
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param QUERY_STRING $query_string;
fastcgi_intercept_errors on;

fastcgi_pass unix:/var/run/php/php8.2-fpm.sock;
}

/etc/php/8.2/fpm/pool.d/www.conf:

user = www-data
group = www-data

listen = /var/run/php/php8.2-fpm.sock


ls -l /var/run/php/php8.2-fpm.sock;
srw-rw---- 1 www-data www-data 0 Jan 24 14:43 /var/run/php/php8.2-fpm.sock

nginx/error.log

2023/01/24 15:32:46 [error] 82564#82564: *1 FastCGI sent in stderr: "PHP message: PHP Warning: require(/var/www/grammartiste.com/web/vendor/autoload.php): Failed to open stream: Permission denied in /var/www/grammartiste.com/web/autoload.php on line 16PHP message: PHP Fatal error: Uncaught Error: Failed opening required '/var/www/grammartiste.com/web/vendor/autoload.php' (include_path='.:/usr/share/php') in /var/www/grammartiste.com/web/autoload.php:16
Stack trace:
#0 /var/www/grammartiste.com/web/index.php(14): require_once()
#1 {main}
thrown in /var/www/grammartiste.com/web/autoload.php on line 16" while reading response header from upstream, client: 202.90.245.199, server: grammartiste.com, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php8.2-fpm.sock:", host: "grammartiste.com"

ls -l /var/www/grammartiste.com/web/vendor/autoload.php
-rwxrwxrwx 1 www-data www-data 771 Jan 24 13:00 /var/www/grammartiste.com/web/vendor/autoload.php

ls -l /var/www/grammartiste.com/web/vendor/autoload.php
-rwxrwxrwx 1 www-data www-data 771 Jan 24 13:00 /var/www/grammartiste.com/web/vendor/autoload.php

ls -l /usr/share/php
total 184
drwxr-xr-x 3 root root 4096 Jan 24 12:29 8.2
drwxr-xr-x 2 root root 4096 Jan 24 12:29 Archive
drwxr-xr-x 25 root root 4096 Nov 10 03:03 Composer
drwxr-xr-x 2 root root 4096 Jan 24 12:29 Console
drwxr-xr-x 5 root root 4096 Nov 10 03:03 data
drwxr-xr-x 2 root root 4096 Nov 8 12:17 DB
-rw-r--r-- 1 root root 43744 May 2 2020 DB.php
drwxr-xr-x 7 root root 4096 Nov 10 03:03 JsonSchema
drwxr-xr-x 2 root root 4096 Jan 24 12:29 OS
drwxr-xr-x 11 root root 4096 Jan 24 12:29 PEAR
-rw-r--r-- 1 root root 14825 Dec 10 02:54 pearcmd.php
-rw-r--r-- 1 root root 36171 Dec 10 02:54 PEAR.php
-rw-r--r-- 1 root root 1093 Dec 10 02:54 peclcmd.php
drwxr-xr-x 4 root root 4096 Nov 10 03:03 Psr
drwxr-xr-x 3 root root 4096 Nov 10 03:03 React
drwxr-xr-x 3 root root 4096 Nov 10 03:03 Seld
drwxr-xr-x 3 root root 4096 Jan 24 12:29 Structures
drwxr-xr-x 5 root root 4096 Nov 10 03:03 Symfony
-rw-r--r-- 1 root root 20694 Dec 10 02:54 System.php
drwxr-xr-x 2 root root 4096 Jan 24 12:29 XML
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 79
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready