ID:               48839
 Updated by:       paj...@php.net
 Reported By:      pkwan at advsofteng dot net
 Status:           To be documented
 Bug Type:         Scripting Engine problem
 Operating System: win32 only
 PHP Version:      5.3.0
 New Comment:

Yes, I'm sure. There are reasons why it has been done (avoid crashes
being one of them). Also I don't see how performance can be affected by
the dl removal (using dl is slow) :)


Previous Comments:
------------------------------------------------------------------------

[2009-07-08 10:37:28] pkwan at advsofteng dot net

Are you sure you want it do be a doc bug?

CGI PHP will be very inefficient and has very poor performance without
"dl".

It is because in CGI, PHP needs to be restarted for every PHP request.
Without "dl", all extensions have to be defined in "php.ini". It means
PHP needs to load all extensions for every PHP request, even if the
extensions are not used by a script.

I would think it is reasonable to load extensions using "php.ini" for
the PHP Apache module, because PHP is only started once as an Apache
module. However, for CGI PHP, it is a poor design to load extensions
using "php.ini". Using "dl" is much more reasonable.

In my opinion, the original documentation to allow "dl" to be used for
"CLI" and "CGI" seems to be a good design.

------------------------------------------------------------------------

[2009-07-08 09:21:21] paj...@php.net

moved this bug as a doc bug. 

------------------------------------------------------------------------

[2009-07-08 06:36:27] pkwan at advsofteng dot net

But you are using php-cgi in the command line, not as a CGI.

If you actually used php-cgi as a CGI, the code in "cgi_main.c" will
detect that it is used as a CGI (by checking the CGI environmental
variables), and disables "dl". This is done by the following code in
"cgi_main.c".

if (!cgi && !fastcgi && !bindpath) {
   cgi_sapi_module.additional_functions = additional_functions;
}

------------------------------------------------------------------------

[2009-07-08 00:05:43] paj...@php.net

I'm not sure what you are using but dl works with cgi:

C:....\php530>php-cgi.exe t.php
X-Powered-By: PHP/5.3.0
Content-type: text/html

<br />
<b>Warning</b>:  dl() [<a href='function.dl'>function.dl</a>]: Unable
to load dynamic library 'C:\php5\any_name.dll' - T
he specified module could not be found.
 in <b>C:\....\t.php</b> on line <b>1</b><br />


------------------------------------------------------------------------

[2009-07-07 18:49:57] pkwan at advsofteng dot net

Description:
------------
According to the PHP documentation, the "dl" function is deprecated,
but not disabled. So it should continue to work. The followings are the
supporting documentation as published in http://www.php.net/dl


- 5.3.0 This function now throws an E_DEPRECATED notice on all sapi's
except for CLI, CGI and Embed.  

- As of PHP 5, the dl() function is deprecated in every SAPI except
CLI. Use Extension Loading Directives method instead. 

- Since PHP 6 this function is disabled in all SAPIs, except CLI, CGI
and embed. 


The above means "dl" is disabled in some SAPI only starting from PHP 6.
Even in PHP 6, "dl" should continue to work in CLI, CGI and embed.

In PHP 5, "dl" is deprecated but not disabled. It should work in CLI,
CGI, Embed, and at most throws a E_DEPRECATED notice in other SAPI.


In practice, "dl" does not work in CGI, and no E_DEPRECATED notice is
throw in any case. After some trouble-shooting, the code that causes the
problem is (located in cgi_main.c):

if (!cgi && !fastcgi && !bindpath) {
   cgi_sapi_module.additional_functions = additional_functions;
}

The above disables the "dl" function in CGI usage, conflicting with the
documentation.




Reproduce code:
---------------
<?php dl("any_name.dll"); ?>


Expected result:
----------------
If the above code is executed in CGI, no error message is expected. 



Actual result:
--------------
Fatal error: Call to undefined function dl() in
C:\Inetpub\Scripts\phpinfo.php on line 1



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=48839&edit=1

Reply via email to