`opcache.restrict_api` may not correctly apply through web server
Open
Nobody has claimed this yet.
bug
Extension: opcache
SAPI: apache2handler
Status: Needs Triage
- Dominant language
- XML
- Stars
- 596
- Forks
- 890
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 55
Description
Description
I observe an issue when correct opcache.restrict_api setting isn't correctly applied when run through an Apache (2.4.52) web server.
The following code:
<?php
var_dump(
php_sapi_name(),
ini_get( 'opcache.restrict_api' ),
__FILE__,
strpos( __FILE__, ini_get( 'opcache.restrict_api' ) )
);
opcache_get_status();
Non-matching path, CLI (correct, warning)
string(3) "cli"
string(10) "C:\serverr"
string(47) "C:\server\www\dev\opcache-restrict-api-test.php"
bool(false)
Warning: Zend OPcache API is restricted by "restrict_api" configuration directive in C:\server\www\dev\opcache-restrict-api-test.php on line 9
Non-matching path, web server (correct, warning)
string(14) "apache2handler" string(10) "C:\serverr" string(47) "C:\server\www\dev\opcache-restrict-api-test.php" bool(false)
Warning: Zend OPcache API is restricted by "restrict_api" configuration directive in C:\server\www\dev\opcache-restrict-api-test.php on line 9
Matching path, CLI (correct, no warning)
string(3) "cli"
string(9) "C:\server"
string(47) "C:\server\www\dev\opcache-restrict-api-test.php"
int(0)
Matching path, web server (INCORRECT, warning)
string(14) "apache2handler" string(9) "C:\server" string(47) "C:\server\www\dev\opcache-restrict-api-test.php" int(0)
Warning: Zend OPcache API is restricted by "restrict_api" configuration directive in C:\server\www\dev\opcache-restrict-api-test.php on line 9
PHP Version
8.1.2
Operating System
Windows 10
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the supplied PHP 8.1.2 reproduction using opcache.restrict_api and opcache_get_status under CLI and Apache on Windows 10. Compare the matching-path results and determine whether the discrepancy is documented or requires an upstream PHP investigation; done means the observed behavior and the appropriate documentation or issue outcome are clearly established.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- apache, php
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100