-2

I am using smarty template system on my website.

When it tries to cache some data, a fatal error occurs:

Fatal error: Smarty error: unable to write to $compile_dir '/var/www/html/cache/frontend'. Be sure $compile_dir is writable by the web server user. in /var/www/html/include/smarty/libs/Smarty.class.php on line 1092

I just get my vps today (Centos 7) and made basic LAMP setup.

I have uploaded all the content inside /var/www/html using sftp (root user). Then I have (still using filezilla) set /var/www/html/cache and all it's files/subdirectories to 777.

Whatever I try I can't get apache it to write on the cache folder or subfolder.

And the strange thing is that when doing

[root@localhost ~]# chmod -R 0777 /var/www/html/cache

the cache folder is still set to 2777.

I have also tried to make "apache" as the owner of /var/www/html/cache and all it's files/subdirectories but I still can't write on it.

I am completly lost and very newbie when it comes to server setup.

Any help would be appreciated, thank you.

2
  • Check the permissions on all directories above - /var, /var/www and /var/www/html.
    – Jenny D
    Nov 23, 2014 at 12:37
  • If you had provided the relevant information from your logs, in particular the audit log and error_log we may have been able to help you solve this correctly. Disabling SELinux may be expedient but it is almost never the correct solution.
    – user9517
    Nov 23, 2014 at 17:05

2 Answers 2

1

Did you try creating /var/www/html/cache/frontend?

mkdir /var/www/html/cache/frontend
chown apache /var/www/html/cache/frontend
chmod 0750 /var/www/html/cache/frontend
-2

I have fixed the problem by disabling SELinux.

I have used the command: setenforce 0

Then I was able to chmod to 0777 the cache folder and all it's subdir from filezilla, logging using SFTP.

Hope it can help somebody

1
  • 1
    Instead of disabling SElinux - why don't you spend bit of time learning it and fix the problem correctly ? Disabling SElinux is (almost never) the correct answer.
    – user9517
    Nov 23, 2014 at 16:58

Not the answer you're looking for? Browse other questions tagged .