perftools / xhgui

Web interface for XHProf profiling data can store data in MongoDB or PDO database
1.65k stars 342 forks source link

PHP files in docker 0.18.0 image aren't readable to www-data user #411

Closed Naktibalda closed 3 years ago

Naktibalda commented 3 years ago

I deployed xhgui/xhgui:0.18.0 image to Kubernetes cluster, but php-fpm is failing to read index.php file.

127.0.0.1 - 18/Jan/2021:08:12:34 +0000 "GET /index.php" 403 [18-Jan-2021 08:12:34] WARNING: [pool www] child 13 said into stderr: "NOTICE: PHP message: PHP Warning: Unknown: failed to open stream: Permission denied in Unknown on line 0" [18-Jan-2021 08:12:34] WARNING: [pool www] child 13 said into stderr: "ERROR: Unable to open primary script: /var/www/xhgui/webroot/index.php (Permission denied)" 2021/01/18 08:12:34 [error] 11#11: *1 FastCGI sent in stderr: "PHP message: PHP Warning: Unknown: failed to open stream: Permission denied in Unknown on line 0Unable to open primary script: /var/www/xhgui/webroot/index.php (Permission denied)" while reading response header from upstream, client: 127.0.0.1, server: _, request: "GET /xhgui HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "dev.test" 127.0.0.1 - - [18/Jan/2021:08:12:34 +0000] "GET /xhgui HTTP/1.1" 403 25 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:84.0) Gecko/20100101 Firefox/84.0" "10.0.21.183"

I think that this error happens because php-fpm runs as www-data, but php files are only readable to root user:

/var/www/xhgui/webroot # ls -la index.php -rw-rw---- 1 root root 122 Jan 6 14:28 index.php

glensc commented 3 years ago

I've pushed over 0.18.0 image

Naktibalda commented 3 years ago

Thank you.