Hello
I installed piwigo in January of 2017 as a way to keep up with all of the photos that our customers send us. It worked great until today. Today I received this message as I tried to connect to my gallery:
Piwigo encountered an irrecoverable error
./_data/templates_c no write access
#1 mkgetdir /var/www/html/gallery/include/template.class.php(116)
#2 Template::__construct /var/www/html/gallery/include/common.inc.php(226)
#3 include_once /var/www/html/gallery/index.php(26)
Where do I begin to try and fix this? I have reset permissions to 777 on everything piwigo related on the server. We only use piwigo on the company intranet. It is installed on CentOS7. I will update this message when I figure out which version of pigwigo I am using along with the php version and MySQL version.
Piwigo version:
PHP version:
MySQL version:
Piwigo URL: http://
Offline
You may have to check ACL (Access Control Lists, sort of extended permissions) on that server, it may have been enabled newly, and/or prevent the web server user from write access (which generally makes sense, but cache and temporary and upload directories need an exception). Setting all permissions to 777 everywhere is dumb anyway.
Offline
erAck wrote:
You may have to check ACL (Access Control Lists, sort of extended permissions) on that server, it may have been enabled newly, and/or prevent the web server user from write access (which generally makes sense, but cache and temporary and upload directories need an exception). Setting all permissions to 777 everywhere is dumb anyway.
I checked the ACL for the 3 files listed in the error message. Root has RWX for everything. I am not sure why this problem just started. The 777 permission thing on this server doesn't matter. It is only for in house use. I set it up to make filing our thousands of photos easier to do so we could keep notes with each image. I am the only one who can SSH into this server, the other users only access through their browsers. I am the only one with admin privileges. I am at a loss as to why this issue happened overnight.
Offline
I should not discuss anything further with someone who tries to defend global 777 permissions, but.. have you checked the permissions of the actual directory in the problem, i.e. _data/templates_c
In your screenshot it's only the code files mentioned in the backtrace for which read permissions for the web server user are sufficient.
Offline
erAck wrote:
I should not discuss anything further with someone who tries to defend global 777 permissions, but.. have you checked the permissions of the actual directory in the problem, i.e. _data/templates_c
In your screenshot it's only the code files mentioned in the backtrace for which read permissions for the web server user are sufficient.
I am not sure why it matters so much to you that I did a global 777 -R on gallery directory. I did it to try and see if that would fix the no write access. I never said that I was going to leave the permissions this way. I looked at the _data/templates_c and it also has rwx permissions for everyone (temporarily) . Root is the owner and group. I was able to create and save a test.txt file in that directory. I am not sure how to proceed.
Offline
You said CentOS 7, so could be SElinux-related
What does following command spit out (as root):
# getenforce
If it says "Enforcing", check the context of /var/www/html/gallery/_data/templates_c
# ls -Z /var/www/html/gallery/_data/ | grep templates_c
It should be either "httpd_sys_rw_content_t" or "public_content_rw_t" (the _rw_ matters)
If that's not the case, set it that way:
chcon -R -t httpd_sys_rw_content_t /var/www/html/gallery/_data
Or, set selinux to permissive.
ad hoc:
# setenforce 0
and persist this in /etc/sysconfig/selinux
Last edited by teekay (2017-09-25 15:10:02)
Offline
teekay wrote:
You said CentOS 7, so could be SElinux-related
What does following command spit out (as root):Code:
# getenforceIf it says "Enforcing", check the context of /var/www/html/gallery/_data/templates_c
Code:
# ls -Z /var/www/html/gallery/_data/ | grep templates_cIt should be either "httpd_sys_rw_content_t" or "public_content_rw_t" (the _rw_ matters)
If that's not the case, set it that way:Code:
chcon -R -t httpd_sys_rw_content_t /var/www/html/gallery/_dataOr, set selinux to permissive.
ad hoc:Code:
# setenforce 0and persist this in /etc/sysconfig/selinux
Thank you for the detailed response here. It was an selinux problem. I have corrected the issue and gallery is working again. I have also removed the 777 permissions and reset them properly. The gallery is still working with the reassigned permissions.
Offline
See also CentOS Troubleshooting SELinux or RHEL SELinux Troubleshooting.
Last edited by erAck (2017-09-27 00:54:57)
Offline