-2

This question already has an answer here:

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.

marked as duplicate by Ward, Jenny D, Iain, TheCleaner, Sirex Nov 26 '14 at 1:10

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Check the permissions on all directories above - /var, /var/www and /var/www/html. – Jenny D Nov 23 '14 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. – Iain Nov 23 '14 at 17:05
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
    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. – Iain Nov 23 '14 at 16:58

Not the answer you're looking for? Browse other questions tagged or ask your own question.