|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2009-07-06 15:50 UTC] pkwan at advsofteng dot net
Description:
------------
Using the "dl" function results in a "Call to undefined function dl()" error if the PHP is used with a web server. It is as if the "dl" function does not exist in PHP any more. This has been tested using "php-cgi.exe" VC6 and on IIS on both Windows 2000 and Windows XP, and using "php-cgi.exe" VC9 on IIS on Windows XP.
However, when using "php.exe" or "php-cgi.exe" in a DOS shell interactively, the "dl" function works normally.
Reproduce code:
---------------
<?php dl("any_name.dll"); ?>
Expected result:
----------------
If the DLL is loaded successfully, no message is expected. Otherwise, some meaningful error message is expected.
Actual result:
--------------
Fatal error: Call to undefined function dl() in C:\Inetpub\Scripts\phpinfo.php on line 1
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 05:00:02 2025 UTC |
this bug is not bogus. it's either valid or should be reclassified as a documentation bug. the manual says (as of August 16, 2010): 5.3.0 dl() is now disabled in some SAPI's due to stability issues. The only SAPI's that allow dl() are: CLI, CGI and Embed. in fact, a peek at php-5.3.3/ext/standard/dl.c suggests that the manual is quite misleading as it leaves the reader thinking that dl() will work in non-TS versions of CLI, CGI and Embed just find, when in fact the function is E_DEPRECATED across the board: if ((strncmp(sapi_module.name, "cgi", 3) != 0) && (strcmp(sapi_module.name, "cli") != 0) && (strncmp(sapi_module.name, "embed", 5) != 0) ) { #ifdef ZTS php_error_docref(NULL TSRMLS_CC, E_WARNING, "Not supported in multithreaded Web servers - use extension=%s in your php.ini", filename); RETURN_FALSE; #else php_error_docref(NULL TSRMLS_CC, E_DEPRECATED, "dl() is deprecated - use extension=%s in your php.ini", filename); #endif } that's correct as long as i run php-cgi.exe on the command line: var_dump(extension_loaded('sqlsrv')); dl('php_sqlsrv.dll'); var_dump(extension_loaded('sqlsrv')); run with php-cgi -nq -d extension_dir=$somewhere -d error_reporting=-1 test.php gives bool(false) bool(true) however, running the same php-cgi inside Apache 2.2 on Windows, the dl() function does not exist. tested with 5.3.3-nts-vc9.