wiki:TemplatePermissions

Version 5 (modified by anonymous, 12 years ago) (diff)

dmorton-testing anon submissions

Why can't Maia read my template files?

Typical error messages:

*Warning*: fopen(/var/amavis/maia/templates/newuser.tpl): failed to open
 stream: Permission denied in
 /var/www/public_html/mail/internal-init.php* on line *150*

*Warning*: filesize(): Stat failed for
 /var/amavis/maia/templates/newuser.tpl (errno=13 - Permission denied) in
 /var/www/public_html/mail/internal-init.php* on line *151*

*Warning*: fread(): supplied argument is not a valid stream resource in
 /var/www/public_html/mail/internal-init.php* on line *151*

*Warning*: fclose(): supplied argument is not a valid stream resource in
 /var/www/public_html/mail/internal-init.php* on line *152*

The template files (*.tpl) need to be readable by your web server user. If your web server runs as user "www", or "www-data" or somesuch, that user needs to have read permissions on the template files. You can do this, for example, by adding this user to the "amavis" group, and making sure that the "amavis" group has read permissions on the templates.

In other words, on /var/amavis/maia/templates, let all of the template files be owned by amavis, group amavis, readable by both:

  chown amavis.amavis /var/amavis/maia/templates/*.tpl
  chmod 644 /var/amavis/maia/templates/*.tpl

Then, if your web server user is "www", add that user to your "amavis" group:

  usermod -G amavis www

In a RedHat?-like install of Apache 2.x (RedHat, CentOS, Fedora), it is customary to place website-specific configuration files in /etc/httpd/conf.d as separate files for each website subdirectory. If you do not specify explicit access permissions for /var/amavis/maia/templates, you will get this error, regardless of the directory/user permissions. To resolve the issue, you can create a /etc/httpd/conf.d/maia.conf file that looks something like this:

Alias /maia /var/www/maia

<Directory /var/amavis/maia/templates>
    Order allow,deny
    Allow from all
</Directory>

Another issue to investigate is whether SELinux is installed and causing problems.


Back to FAQ