I'm upgrading to php7.4 and want to take advantage of the new opcache preloading.
When I service php7.4-fpm start
I get the following errors:
NOTICE: PHP message: PHP Warning: PHP Startup: failed to open stream: Permission denied in Unknown on line 0
NOTICE: PHP message: PHP Fatal error: PHP Startup: Failed opening required '/mnt/a/b/c/opcachePreload.php' (include_path='.:/usr/share/php:/mnt/a/b/c:/mnt/a/b/d') in Unknown on line 0
php7.4-fpm.service: Main process exited, code=exited, status=70/n/a
Failed to start The PHP 7.4 FastCGI Process Manager.
My fpm/php.ini
includes the following opcache settings:
include_path = ".:/usr/share/php:/mnt/a/b/c"
opcache.save_comments = 1
opcache.max_accelerated_files = 7963
opcache.interned_strings_buffer = 16
opcache.fast_shutdown = 1
opcache.revalidate_freq = 0
opcache.validate_timestamps = 0
opcache.memory_consumption = 128
opcache.preload = /mnt/a/b/c/opcachePreload.php
opcache.preload_user = www-data
I've tried having the opcachePreload.php
contain only <?php
and the error still happened, normally it contains something like this, with a couple of absolute paths in the array:
<?php
declare(strict_types=1);
$scriptsArr = [
'path',
'path',
];
foreach ($scriptsArr as $fileStr) {
opcache_compile_file($fileStr);
}
I've tried a range of different levels of file-permissions on it (0600, 0700, 0770, 0777, owned by root), currently ls -l /mnt/a/b/c/opcachePreload.php
shows:
-rwxrwxrwx 1 www-data www-data 336 Dec 26 15:11 /mnt/a/b/c/opcachePreload.php
Is it a file-permission problem, or a conflict in the configurations, or a php7.4 bug, or something else?
Is the opcache.preload
interpreted as some sort of relative path instead of absolute? (I've tried opcache.preload = ./opcachePreload.php
)
What else can I try?
Try to put your opcachePreload.php
inside for example /var/www/html
and change opcache.preload
to
opcache.preload = /var/www/html/opcachePreload.php
If that works then www-data
doesn't have permission to access files in /mnt/a/b/c/
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.