php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #72199 opcache_compile_file() function throws error message.
Submitted: 2016-05-11 15:02 UTC Modified: 2016-05-11 15:47 UTC
From: ian at subnet192 dot com Assigned:
Status: Closed Package: opcache
PHP Version: 7.0.6 OS: Ubuntu 14.04 x86
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: ian at subnet192 dot com
New email:
PHP Version: OS:

 

 [2016-05-11 15:02 UTC] ian at subnet192 dot com
Description:
------------
Hi!

Compiling files through opcache_compile_file fails with the notice even if opcache is enabled: 

PHP Notice:  Zend OPcache seems to be disabled, can't compile file in compile.php on line 8

The following lines of the zend_accelerator_module.c file seems to be the cause of the notice if I'm not mistaken.

	if (!ZCG(enabled) || !accel_startup_ok || !ZCSG(accelerator_enabled)) {
		zend_error(E_NOTICE, ACCELERATOR_PRODUCT_NAME " seems to be disabled, can't compile file");
		RETURN_FALSE;
	}

Based on my configuration, ZCG(enabled) should return true. Therefore, my guess is that either accel_startup_ok or ZCSG(accelerator_enabled) is the issue here. 

Test script:
---------------
// compile.php
<?php
  var_dump(opcache_get_status());
  var_dump(opcache_get_configuration());
  opcache_compile_file("myfile.php");
?>

I'm calling this script in command line : php -c php.ini compile.php

Actual result:
--------------
Running var_dump(opcache_get_status()) returns :

  ["opcache_enabled"]=>
  bool(false)
  ["file_cache"]=>
  string(63) "/hunt_opcache"
  ["file_cache_only"]=>
  bool(true)

Here we can see opcache_enabled is false.

Running var_dump(opcache_get_configuration()) returns the following relevant lines :

  ["directives"]=>
  array(28) {
    ["opcache.enable"]=>
    bool(true)
    ["opcache.enable_cli"]=>
    bool(true)
    ["opcache.use_cwd"]=>
    bool(true)
    ...
  }
  ["version"]=>
  array(2) {
    ["version"]=>
    string(9) "7.0.6-dev"
    ["opcache_product_name"]=>
    string(12) "Zend OPcache"
  }
}

... Here, OPcache configuration shows that OPcache is enabled.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-05-11 15:47 UTC] ian at subnet192 dot com
-Status: Open +Status: Closed
 [2016-05-11 15:47 UTC] ian at subnet192 dot com
Ok, I figured out what the issue is.

Seems like enabling file_cache_only will disable the opcache_compile_file function.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jan 08 12:01:29 2025 UTC