【发布时间】:2019-12-26 22:33:04
【问题描述】:
我正在升级到 php7.4 并希望利用新的 opcache 预加载。
当我service php7.4-fpm start 时出现以下错误:
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.
我的fpm/php.ini 包含以下 opcache 设置:
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
我试过让opcachePreload.php 只包含<?php 并且错误仍然发生,通常它包含类似这样的内容,数组中有几个绝对路径:
<?php
declare(strict_types=1);
$scriptsArr = [
'path',
'path',
];
foreach ($scriptsArr as $fileStr) {
opcache_compile_file($fileStr);
}
我已经尝试了一系列不同级别的文件权限(0600、0700、0770、0777,由 root 拥有),目前ls -l /mnt/a/b/c/opcachePreload.php 显示:
-rwxrwxrwx 1 www-data www-data 336 Dec 26 15:11 /mnt/a/b/c/opcachePreload.php
是文件权限问题,还是配置冲突,还是php7.4的bug,还是别的什么?
opcache.preload 是否被解释为某种相对路径而不是绝对路径? (我试过opcache.preload = ./opcachePreload.php)
我还能尝试什么?
【问题讨论】:
-
只是在黑暗中拍摄,你检查了
/mnt/a/b/c/的权限吗?
标签: php preload opcache php-7.4