Prestashop: var/cache/prod/appParameters.php recreated with 000 permissions

Created on 13 Oct 2018  路  11Comments  路  Source: PrestaShop/PrestaShop

Describe the bug
var/cache/prod/appParameters.php or var/cache/dev/appParameters.php are always generated with chmod 000 permissions (instead of 644 or 666)

To Reproduce
Steps to reproduce the behavior:

  1. Go to 'Param猫tres avanc茅s'/'Performances'
  2. Click on 'Mode Debug' and save
  3. See error

Additionnal information
PrestaShop version: 1.7.4.3
PHP version: 7.0 on Debian 9

1.7.4.3 CO Fixed Performance

Most helpful comment

Hi,

Found the source of the problem : opcache config.
With .user.ini, I've put :

opcache.revalidate_freq = 0
opcache.validate_timestamps = 1
opcache.revalidate_freq = 0
opcache.fast_shutdown = 0

And it works ! (at last)

All 11 comments

If I add this line to config/bootstrap.php :
$filesystem->chmod($cachedParameters, 0660);
Here :

    if (!$lastParametersCacheModificationTime || $lastParametersCacheModificationTime < $lastParametersModificationTime) {
        // When parameters file is available, update its cache if it is stale.
        if (file_exists($phpParametersFilepath)) {
            $config = require($phpParametersFilepath);
            $exportPhpConfigFile($config, $cachedParameters);
        } elseif (file_exists($yamlParametersFilepath)) {
            $config = Yaml::parse($yamlParametersFilepath);
            $exportPhpConfigFile($config, $cachedParameters);
        }
        $filesystem->chmod($cachedParameters, 0660);
    }

It's ok for me (except I have to refresh the page until it's not blanck)

Hi @jpyrat,

Thanks for your report.
After enabling dev mode, the var/cache/prod/appParameters.php is generated with chmod 666 permissions.
I attached a screenshot.
image
Thanks to check & feedback.

Hi,

Found the source of the problem : opcache config.
With .user.ini, I've put :

opcache.revalidate_freq = 0
opcache.validate_timestamps = 1
opcache.revalidate_freq = 0
opcache.fast_shutdown = 0

And it works ! (at last)

Thanks jpyrat! Works fine in my case, too. In fact I found some other post with opcache settings, but it did not work. Yours work perfect!

HI @jpyrat,

Thanks for your feedback.
I close the issue, feel free to open a new one when needed.
Thanks!

Hello jpyrat , i have same problem like you. Can you please describe exactly fix for:
Found the source of the problem : opcache config.
With .user.ini, I've put :

opcache.revalidate_freq = 0
opcache.validate_timestamps = 1
opcache.revalidate_freq = 0
opcache.fast_shutdown = 0

And it works ! (at last)

Kind Regards
Igor

After @khouloudbelguith recommendation on #13913, this seems to work for me too.

I'm under PHP 7.2, just notice that opcache.fast_shutdown has been deleted start from PHP 7.2, so the remaining settings I use are:

opcache.revalidate_freq = 0
opcache.validate_timestamps = 1

Best Regards

@PierreRambaud why not calling opcache_reset() to avoid forcing the revalidate_freq = 0 / validate_timestamp ?

I have the same doubt as @PierreRambaud.
Forcing the revalidation frequency to 0, in my opinion, is not an acceptable solution.

Because we use opcache.validate_timestamps=1 in the docker file, which is a bad idea for production mode and symfony. Also, calling opcache_reset can be an idea, but when? where? we mustn't add an ugly if opcache then clear anywhere :/
Feel free to improve the configuration and create a pull request if you find a better solution :)

First, Prestashop says that using opcache is a good performance improvement, but then it uses values for parameters that limit the technology's possibilities, until it seems that it is almost not being used.
When, and where, are clear, when the Prestashop cache is cleared, and when a module is removed
There may be other scenarios, but this is better than nothing.
I would try to make the changes myself, but I don't have the necessary knowledge about Prestashop programming yet. That doesn't mean that my development skills on other platforms don't allow me to see that analyzing the situation and applying a solution, even a partial one, is not very difficult for someone who knows the platform.

Was this page helpful?
0 / 5 - 0 ratings