|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2020-06-28 08:29 UTC] buschmann at nidsa dot net
Description:
------------
When trying to load the opcache with php-scripts from tools and our application in a script to preload the opcache: (here one example line:)
<?php
$bresult=opcache_compile_file('N:\Apache\tcpdf\include\tcpdf_colors.php');
I get multiple entries in the apache error.log file as :
...
[Sun Jun 28 09:58:00.642291 2020] [mpm_winnt:notice] [pid 6572:tid 548] AH00354: Child: Starting 64 worker threads.
VirtualProtect() failed
VirtualProtect() failed
...
This was the first operation (explicitly and manually called from a browser) after a fresh start from Apache/php as a service.
It seems that 2 entries per compile request are generated (without timestamp).
There are no errors reported in php_err.log.
The scripts have been successfully loaded into opcache as reported by
https://github.com/amnuts/opcache-gui - version 2.5.4
The same preload script has been used under 7.x.y until 7.4.7 for a long time without this issue.
Environment:
- Windows server 2019 64bit Standard in a VM under HyperV
- Apache 2.43 64bit from apachelounge
- php 8 alpha1 64bit thread safe from php.net QA download
- php loaded as a module with php_module
Test script:
---------------
<?php
$bresult=opcache_compile_file('N:\Apache\tcpdf\include\tcpdf_colors.php');
Expected result:
----------------
No error log entry in error.log
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 07:00:01 2025 UTC |
C:\Windows\system32>php -v PHP 8.0.2 (cli) (built: Feb 3 2021 18:36:40) ( ZTS Visual C++ 2019 x64 ) Copyright (c) The PHP Group Zend Engine v4.0.2, Copyright (c) Zend Technologies with Zend OPcache v8.0.2, Copyright (c), by Zend Technologies ----------------------------------------------------------------- ; http://php.net/auto-globals-jit auto_globals_jit = Off ---------------------------------------------------------------- Windows 10 PRO ________________________________________________________________ This setting solved for me this issue$> php -v PHP 8.1.2 (cli) (built: Jan 19 2022 10:18:23) (ZTS Visual C++ 2019 x64) Copyright (c) The PHP Group Zend Engine v4.1.2, Copyright (c) Zend Technologies with Zend OPcache v8.1.2, Copyright (c), by Zend Technologies with Xdebug v3.1.3, Copyright (c) 2002-2022, by Derick Rethans Windows Server 2022 Build 20348.473 --- When starting the webserver (Apache) the error log is being spammed with: VirtualProtect() failed [...] Incorrect parameter --- Solved the issue by adding a line to the php config: >> php.ini [opcache] opcache.jit=off --- auto_globals_jit=Off ...does result in a performance loss while disabling 'opcache.jit' doesn't noticablyI was investigating the same case. I tested CMS EFFCORE on the Windows platform (Windows 10 2021 LTSC x64). After installing Apache House (httpd-2.4.57-win64-VS17.zip) and PHP (php-8.2.11-vs16-x64.zip), I began to include the missing modules to install the system. I enabled all the required modules and the system installed without problems. I ran all the tests and they ran successfully. Then I decided to speed up the system and enabled OPCache + JIT. After enabling OPCache + JIT I started getting a "white screen" and the message "virtualprotect() failed 87 the parameter is incorrect". After disabling OPCache + JIT or OPCache the problem went away. I was wondering what this error was. I created a small script and placed it in the "test.php" file. It had the following contents: $path = 'data.php'; $lines_num = 2000; if (!file_exists($path)) { file_put_contents($path, '<?php'."\n", FILE_APPEND); for ($i = 0; $i < $lines_num; $i++) file_put_contents($path, '$data['.$i.'] = \'value '.$i."';\n", FILE_APPEND); file_put_contents($path, 'print \'COUNT: \'.count($data);', FILE_APPEND); print 'FILE WAS CREATED. RELOAD THIS PAGE'; } else { include_once($path); print "\n".'FILE WAS INCLUDED'; } Next, I ran “test.php” from the browser and got a white screen if “lines_num” was greater than 2000 and a normal result if less than 2000. This is an obvious overflow of some memory segment. However, the log did not contain any information about the error. From the console I ran this script with any number of "lines_num" and no problems arose. php -d opcache.jit_debug=1 test.php php -d opcache.jit_debug=1 data.php I concluded that the problem is with the Apache + PHP combination as a module. However, there were no problems under Linux/Unix. Here is the complete list of links: - win: Apache + PHP as a module - !!! JIT problem !!! - win: IIS + PHP as FastCGI - OK - win: PHP CLI - OK - nix: Apache + PHP as a module - OK - nix: NGINX + PHP as FastCGI - OK - nix: PHP CLI - OK I had to disable OPCache in "php.ini" via "opcache.enable=0" and the problem went away. In "php.ini" you can disable only JIT via "opcache.jit_buffer_size=0" but this setting cannot be changed directly from PHP code. Changing other "opcache.*" settings in "php.ini" did not lead to anything. You can also disable OPCache + JIT programmatically with the following code: if (DIRECTORY_SEPARATOR === '\\') { ini_set('opcache.enable', false); } Thank you for your attention, I hope it helped.