# CLI/CGI -z command line options is broken

- Thread: https://externals.io/message/126368
- Original archive: https://news-web.php.net/php.internals/126368
- Started by Niels Dossche on 2025-02-10T21:24:16+00:00
- Messages: 3
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · RFCs at https://externals.io/rfc.md · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #126368 — Niels Dossche — 2025-02-10T21:24:16+00:00

URL: https://externals.io/message/126368#126368

Hi internals

We received a bug report (https://github.com/php/php-src/issues/17740) that the `-z` command line option for CLI/CGI doesn't actually work.
This option is supposed to load a zend extension using a command line argument.
However, it turns out that the extension doesn't actually load: PHP will claim that the extension's loaded (in some places), but in reality it never loaded properly.
I did an analysis of why this is happening in that GitHub thread, and a clean solution isn't straight-forward.
Christoph figured out that this option has been broken since at least PHP 5.5, a long time.
As passing `-d zend_extension=foo` on the command line is already a suitable replacement, we'd like to just remove the `-z` option in PHP 8.5 instead of fixing it.

Are there any objections against this? Please let us know.

Kind regards
Niels

---

## #126369 — Larry Garfield — 2025-02-10T22:14:33+00:00

URL: https://externals.io/message/126368#126369 · In reply to: #126368

> Hi internals
>
> We received a bug report (https://github.com/php/php-src/issues/17740) 
> that the `-z` command line option for CLI/CGI doesn't actually work.
> This option is supposed to load a zend extension using a command line 
> argument.
> However, it turns out that the extension doesn't actually load: PHP 
> will claim that the extension's loaded (in some places), but in reality 
> it never loaded properly.
> I did an analysis of why this is happening in that GitHub thread, and a 
> clean solution isn't straight-forward.
> Christoph figured out that this option has been broken since at least 
> PHP 5.5, a long time.
> As passing `-d zend_extension=foo` on the command line is already a 
> suitable replacement, we'd like to just remove the `-z` option in PHP 
> 8.5 instead of fixing it.
>
> Are there any objections against this? Please let us know.
>
> Kind regards
> Niels

Seems reasonable to me.  Perhaps update the -d help text accordingly, if needed?

--Larry Garfield

---

## #126419 — Niels Dossche — 2025-02-15T23:20:37+00:00

URL: https://externals.io/message/126368#126419 · In reply to: #126369

> 
> > […]
> 
> Seems reasonable to me.  Perhaps update the -d help text accordingly, if needed?
> 
> --Larry Garfield

Hi

Just to clarify: the -d option just sets an ini option.
One idea could be to make -z print out a message telling the user to use "-d zend_extension=...". That would make the transition more "gradual".
OTOH this didn't work for ages so nobody realistically relies on this option.

Kind regards
Niels
