Bug #71296 [Com]: Opcache Fatal error when enabling opcache.file_cache_only

From: Date: Fri, 15 Jun 2018 12:56:08 +0000
Subject: Bug #71296 [Com]: Opcache Fatal error when enabling opcache.file_cache_only
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-215738@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=71296&edit=1

 ID:                 71296
 Comment by:         php at 9hz dot de
 Reported by:        cyberdevil001 at telenet dot be
 Summary:            Opcache Fatal error when enabling
                     opcache.file_cache_only
 Status:             Open
 Type:               Bug
 Package:            opcache
 Operating System:   CentOS
 PHP Version:        7.0.1
 Block user comment: N
 Private report:     N

 New Comment:

I know it's an old question, but:
>> Why is it not working with /tmp/.opcache while this folder is set in the open_basedir
>> setting:
>> open_basedir	>>
>> /home/admin/:/tmp:/var/tmp:/usr/local/lib/php/:/usr/local/php70/lib/php/

I think debian uses a virtual /tmp/ directory for each process. so if you create .opcache within you
ssh's /tmp/ that directory does not exists in apache's /tmp dir.
try simply using /tmp/ then it should work


Previous Comments:
------------------------------------------------------------------------
[2017-04-04 14:51:43] max dot novikov at gmail dot com

I've experienced the same issue and found out that you cannot set absolute path for opcache
directory, only relative, for reasons unknown. I.e.
/var/www/html/.opcache doesn't work
../html/.opcache does

------------------------------------------------------------------------
[2016-12-21 13:44:07] sailormax at inbox dot lv

Same problem on Windows. PHP 7.0.14/7.1.0

display_errors = On
display_startup_errors = On
error_reporting = E_ALL
extension_dir = ".\ext"
zend_extension=php_opcache.dll
opcache.enable = 1
opcache.enable_cli = 1
opcache.huge_code_pages = 1
opcache.file_cache = ".\temp\opcache"
opcache.file_cache_only = 1
opcache.file_cache_consistency_checks = 1
opcache.file_cache_fallback = 1

php --version
=> (13140): Fatal Error opcache.file_cache_only is set without a proper setting of
opcache.file_cache

------------------------------------------------------------------------
[2016-01-07 09:44:25] cyberdevil001 at telenet dot be

Was able to get it working by changing the path to:

opcache.file_cache=/home/admin/public_html/.opcache

Why is it not working with /tmp/.opcache while this folder is set in the open_basedir setting:
open_basedir	/home/admin/:/tmp:/var/tmp:/usr/local/lib/php/:/usr/local/php70/lib/php/

Changed the owner of /tmp/.opcache to admin which is the same as /home/admin/public_html/.opcache
but still it doesn't work in the /tmp directory.

------------------------------------------------------------------------
[2016-01-07 09:15:05] cyberdevil001 at telenet dot be

Changed the log_verbosity_level to 3 with the following result:

Thu Jan  7 10:11:34 2016 (26904): Warning opcache.file_cache must be a full path of accessable
directory.
Thu Jan  7 10:11:34 2016 (26904): Fatal Error opcache.file_cache_only is set without a proper
setting of opcache.file_cache

Information of the directory:

ls -al /tmp/.opcache/
totaal 8
drwxrwxrwx   2 root root 4096  5 jan 23:36 .
drwxrwxrwt. 15 root root 4096  7 jan 10:11 ..

So directory has all the rights to be used.
Checked the PHP code https://github.com/php/php-src/blob/master/ext/opcache/ZendAccelerator.c
:


#ifdef HAVE_OPCACHE_FILE_CACHE
	} else if (!ZCG(accel_directives).file_cache) {
		accel_startup_ok = 0;
		zend_accel_error(ACCEL_LOG_FATAL, "opcache.file_cache_only is set without a proper setting of
opcache.file_cache");
		return SUCCESS;
	} 

So this error will only be shown if opcache.file_cache is empty right? Which is not the case.

------------------------------------------------------------------------
[2016-01-07 03:30:51] laruence@php.net

try -d opcache.log_verbosity_level=3, it probably because /tmp/.opcache is not accessable

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=71296


--
Edit this bug report at https://bugs.php.net/bug.php?id=71296&edit=1


Thread (10 messages)

« previous php.bugs (#215738) next »