Fatal error: Smarty error: unable to write to $compile_dir

Fatal error: Smarty error: unable to write to $compile_dir ‘/var/www/html/ojs/cache/t_compile’. Be sure $compile_dir is writable by the web server user. in /var/www/html/ojs/lib/pkp/lib/vendor/smarty/smarty/libs/Smarty.class.php on line 1094

Hi @Ashik_S,

See e.g. How should file permissions be set? - #2 by ctgraham.

Regards,
Alec Smecher
Public Knowledge Project Team

Hello Ashik_S, good day

Sorry for the inconvenience but you can tell me please what is the configuration of the folders so that this error disappears …

I have done following:
sudo chmod -R 755 html
sudo chmod -R 777 html / ojs / cache
sudo chmod -R 777 html / ojs / public
sudo chmod -R 777 html / ojs / plugins
sudo chmod -R 777 html / ojs / config.inc.php

sudo chown -R apache: MyUser html / ojs / cache
sudo chown -R apache: MyUser html / ojs / public
sudo chown -R apache: MyUser html / ojs / plugins
sudo chown -R apache: MyUser html / ojs / config.inc.php

  • MyUser = my user on the CENTOS server

But still the same error keeps coming up, of which you mention initially, if you are so kind as to indicate what is the proper configuration of the folders, or if there is something else to do?

I’ve been trying to solve this problem for weeks, but I have not succeeded

Thank you very much and greetings!!!
Jc

Hi @JoseCandido,

Does your server have SELinux extensions installed and enabled?

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher

Thank you very much for responding, it was actually something of SELinux try to leave it enabled but OJS does not work, but when I disable SELinux everything starts working correctly.

Do you think there is a problem if I leave it disabled?

Thank you very much for your support

Regards!!!

José Cándido

Hi @JoseCandido,

You’ll either need to disable SELinux, or to configure it so that OJS has enough permission to manage its files. SELinux essentially adds a new toolset for controlling permissions at a finer level. OJS is compatible with SELinux, but you’ll need to know how SELinux works.

Regards,
Alec Smecher
Public Knowledge Project Team