# Extension loading improvements

- Thread: https://externals.io/message/67039
- Original archive: https://news-web.php.net/php.internals/67039
- Started by Julien Pauli on 2013-04-10T16:50:34+00:00
- Messages: 6
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #67039 — Julien Pauli — 2013-04-10T16:50:34+00:00

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

Hi all,

Here are two branches that improve extension loading mechanisms and remove
dusty old features not used any more.

No BC or nothing, though perhaps some Windows support tricks to add ?

Thoughts ?

https://github.com/jpauli/php-src/extensions_improvements<https://github.com/jpauli/php-src/compare/extensions_improvements>

https://github.com/jpauli/php-src/tree/remove_old_php4_dl

Julien.Pauli

---

## #67041 — Pierre Joye — 2013-04-10T16:57:05+00:00

URL: https://externals.io/message/67039#67041 · In reply to: #67039

hi,


> Hi all,
>
> Here are two branches that improve extension loading mechanisms and remove
> dusty old features not used any more.
>
> No BC or nothing, though perhaps some Windows support tricks to add ?
>
> Thoughts ?
>
> https://github.com/jpauli/php-src/extensions_improvements<https://github.com/jpauli/php-src/compare/extensions_improvements>
>
> https://github.com/jpauli/php-src/tree/remove_old_php4_dl

I'm not sure about the zend_error usage, I remember some issues about
it (not always initialized and similar issues). Dmitry, do you
remember why we used fprintf there? :)

Cheers,
--
Pierre

@pierrejoye

---

## #67042 — Dmitry Stogov — 2013-04-10T17:14:23+00:00

URL: https://externals.io/message/67039#67042 · In reply to: #67041

Hi,

1) I didn't get why do we need fprintf("Loaded/Unloaded extension"). It'll
break all the tests in DEBUG mode

2) zend_error() may work through SAPI handler (e.g. for FastCGI sapi it may
try to send error message to WebServer while request context is not
initialized yet). I think it must work now, but should be double checked.

Thanks. Dmitry.




> hi,
>
> 
> > […]
> remove
> > […]
> https://github.com/jpauli/php-src/compare/extensions_improvements>
> > […]
>
> I'm not sure about the zend_error usage, I remember some issues about
> it (not always initialized and similar issues). Dmitry, do you
> remember why we used fprintf there? :)
>
> Cheers,
> --
> Pierre
>
> @pierrejoye

---

## #67043 — Julien Pauli — 2013-04-11T07:54:26+00:00

URL: https://externals.io/message/67039#67043 · In reply to: #67042

> Hi,
>
> 1) I didn't get why do we need fprintf("Loaded/Unloaded extension"). It'll
> break all the tests in DEBUG mode
>

Great catch


>
> 2) zend_error() may work through SAPI handler (e.g. for FastCGI sapi it
> may try to send error message to WebServer while request context is not
> initialized yet). I think it must work now, but should be double checked.
>
> Thanks. Dmitry.
>

Ok, Do you think as well we could build specific tests for this part ?
We could pre-build some shared objects with different known behavior, and
test for loading extensions and Zend extensions for example.

Julien.Pauli

---

## #67068 — Julien Pauli — 2013-04-12T08:53:46+00:00

URL: https://externals.io/message/67039#67068 · In reply to: #67042

> Hi,
>
> 1) I didn't get why do we need fprintf("Loaded/Unloaded extension"). It'll
> break all the tests in DEBUG mode
>
> 2) zend_error() may work through SAPI handler (e.g. for FastCGI sapi it
> may try to send error message to WebServer while request context is not
> initialized yet). I think it must work now, but should be double checked.
>
>
After several tests on CLI and CGI, I see no bug, but starting cgi makes
the error message being printed twice :

*/tmp/bin/php-cgi -dzend_extension=foo.so -dtrack_errors=1*
*PHP Warning:  /tmp/lib/php/extensions/debug-non-zts-20121212/foo.so
doesn't appear to be a valid Zend Engine extension*
* in Unknown on line 0*
*Unknown(0) : Warning -
/tmp/lib/php/extensions/debug-non-zts-20121212/foo.so doesn't appear to be
a valid Zend Engine extension*
*
*
*PHP Warning:  /tmp/lib/php/extensions/debug-non-zts-20121212/foo.so appear
to be a PHP extension, try to load it using extension=foo.so*
* in Unknown on line 0*
*Unknown(0) : Warning -
/tmp/lib/php/extensions/debug-non-zts-20121212/foo.so appear to be a PHP
extension, try to load it using extension=foo.so*
*
*
Julien.Pauli

---

## #67069 — Ferenc Kovacs — 2013-04-12T09:17:59+00:00

URL: https://externals.io/message/67039#67069 · In reply to: #67068

> 
>
> > […]
> It'll
> > […]
> After several tests on CLI and CGI, I see no bug, but starting cgi makes
> the error message being printed twice :
>
> */tmp/bin/php-cgi -dzend_extension=foo.so -dtrack_errors=1*
> *PHP Warning:  /tmp/lib/php/extensions/debug-non-zts-20121212/foo.so
> doesn't appear to be a valid Zend Engine extension*
> * in Unknown on line 0*
> *Unknown(0) : Warning -
> /tmp/lib/php/extensions/debug-non-zts-20121212/foo.so doesn't appear to be
> a valid Zend Engine extension*
> *
> *
> *PHP Warning:  /tmp/lib/php/extensions/debug-non-zts-20121212/foo.so appear
> to be a PHP extension, try to load it using extension=foo.so*
> * in Unknown on line 0*
> *Unknown(0) : Warning -
> /tmp/lib/php/extensions/debug-non-zts-20121212/foo.so appear to be a PHP
> extension, try to load it using extension=foo.so*
> *
> *
> Julien.Pauli
>

I would guess that both log_errors and display_errors is enabled and the
error_log is set to `STDERR` or `STDOUT` 

-- 
Ferenc Kovács
@Tyr43l - http://tyrael.hu
