Jump to content

Smarty permissions errors (randomly compiles as 'root')


remifr

Recommended Posts

Hi,

I'm asking for help cause I'm out of ideas.

Since December 2021, my Prestashop 1.6.1.9 started to crash and return blank pages until the website was not responding at all.

I found out that there are new folders created in /cache/smarty/compile & /cache/smarty/cache, as 'root' user instead of 'www-data' (or other apache's user).

After I empty the cache (file system) I get this :
 

Quote

 AH01071: Got error 'PHP message: PHP Fatal error:  Uncaught UnexpectedValueException: RecursiveDirectoryIterator::__construct(/var/www/web/cache/smarty/compile/f4/1d): failed to open dir: Permission denied in /var/www/clients/client1/web1/web/tools/smarty/sysplugins/smarty_internal_utility.php:242\nStack trace:\n#0 [internal function]: RecursiveDirectoryIterator->__construct('/var/www/client...', 0)\n#1 /var/www/web/tools/smarty/sysplugins/smarty_internal_utility.php(242): RecursiveDirectoryIterator->getChildren()\n#2 /var/www/web/tools/smarty/Smarty.class.php(1469): Smarty_Internal_Utility::clearCompiledTemplate(NULL, NULL, NULL, Object(SmartyCustom))\n#3 /var/www/web/classes/SmartyCustom.php(99): Smarty->clearCompiledTemplate()\n#4 /var/www/web/classes/SmartyCustom.php(118): SmartyCustomCore->check_compile_cache_invalidation()\n#5 /var/www/web/classes/module/Module.php(2335): SmartyCustomCore->createTempla...\n', referer: https://www.mywebsite.com/admin5/index.php?controller=AdminPerformance&token=f5e91b242b6fecab23fb7e370bf1&conf=4

This folder has 0 as owner (root) : www/web/cache/smarty/compile/f4/1d


My only 2 temporary solutions for this is to "chown -R www-data:www-data" all the time on /cache & /compile Smarty folders
And the other solution is SQL cache instead of filesystem cache, but after a couple of days, the db is too big and I need to manually empty the cache or the site will be too slow to load

Link to comment
Share on other sites

I may have found something, related to a module that needs a CRON job.

I was executing this cron from the root "crontab -e", when I moved the line to a regular user's crontab, the new folders were created with that username, so I ran :

crontab -u www-data -e

now, i'll wait for some days to see if the problem occurs again

Link to comment
Share on other sites

  • 9 months later...

Solution in the reply above (cron)

 

On 12/30/2022 at 4:39 PM, acastanon said:

The same thing happens to us, but always with two directories inside /cache/prod/smarty/compile
Have you found the cause of your problem?

 

Link to comment
Share on other sites

  • 6 months later...
On 3/1/2022 at 9:00 AM, remifr said:

I may have found something, related to a module that needs a CRON job.

I was executing this cron from the root "crontab -e", when I moved the line to a regular user's crontab, the new folders were created with that username, so I ran :

crontab -u www-data -e

now, i'll wait for some days to see if the problem occurs again

I have Plesk and facing this problem in the last days... I can't find in the cronjobs anything like -e but I am quite sure is related to that, as the folders are "recreated" with permissions/owner e (0771) at a same time. I have no idea where to start from...

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...