php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #77801 CLI option -z/--zend_extension does not load specified zend extension
Submitted: 2019-03-26 22:48 UTC Modified: 2021-05-28 13:06 UTC
Votes:1
Avg. Score:1.0 ± 0.0
Reproduced:0 of 1 (0.0%)
From: smokey101stair at gmail dot com Assigned:
Status: Verified Package: *General Issues
PHP Version: Irrelevant OS:
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: smokey101stair at gmail dot com
New email:
PHP Version: OS:

 

 [2019-03-26 22:48 UTC] smokey101stair at gmail dot com
Description:
------------
Using the -z/--zend_extension option to load a zend extension when using php from the CLI doesn't seem to work on Windows. I tested using PHP versions 5.6.40, 7.2.16, and 7.3.3.

In my particular case, I was trying to load xdebug.

php -z <path to xdebug> -m

The above results in no modules listed under [Zend Modules]

php -z <path to xdebug> --re xdebug
php -z <path to xdebug> --rz xdebug
php -z <path to xdebug> --ri xdebug

The above all result in an error stating that xdebug does not exist.

php -d zend_extension=<path to xdebug>

The above can be used as a workaround as it loads the extension as expected.

Please let me know if I can provide any additional information.



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-03-26 23:31 UTC] krakjoe@php.net
-Operating System: Windows 10 +Operating System:
 [2019-03-26 23:31 UTC] krakjoe@php.net
Also happens in other operating systems ...

The reason -m doesn't show it's loaded is clear, they are different getopt blocks.

But even when you run a script with get_loaded_extensions dump, the zend extension is not loaded (tested with opcache which registers a module, the module is not registered).
 [2021-05-28 13:06 UTC] cmb@php.net
The problem is that the order of CLI args processing is borked.
The first getopt() (in main()) processes only some of the args,
then SAPI and modules are started up; only afterwards the second
getopt() block (in do_cli()) processes further args (-z plus some
others), and the extension is loaded, but never initialized.

Given that -z is useless, and -dzend_extension= works as expected,
it might be best to just drop the -z arg.
 [2021-05-28 13:06 UTC] cmb@php.net
-Status: Open +Status: Verified
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Oct 15 21:01:27 2024 UTC