PHP: dl - Manual in Deutsh
PHP: dl - Manual in French
PHP: dl - Manual in Polish

You Are At PHP: dl - Manual Area


recent searches:
include functions , variable functions , post functions...




If you are new to PHP or just need to refresh your skills, this is the place to start. This series of tutorials will give you the basic knowledge you will need to create a simple PHP website.

PHP is a reflective programming language originally designed for producing dynamic web pages.[1] PHP is used mainly in server-side scripting, but can be used from a command line interface or in standalone graphical applications. Textual User Interfaces can also be created using ncurses.

PHP Manual
PrevNext

dl

(PHP 3, PHP 4, PHP 5)

dl -- Loads a PHP extension at runtime

Description

int dl ( string library )

Loads the PHP extension given by the parameter library.

Use extension_loaded() to test whether a given extension is already available or not. This works on both built-in extensions and dynamically loaded ones (either through php.ini or dl()).

Parameters

library

This parameter is only the filename of the extension to load which also depends on your platform. For example, the sockets extension (if compiled as a shared module, not the default!) would be called sockets.so on Unix platforms whereas it is called php_sockets.dll on the Windows platform.

The directory where the extension is loaded from depends on your platform:

Windows - If not explicitly set in the php.ini, the extension is loaded from c:\php4\extensions\ by default.

Unix - If not explicitly set in the php.ini, the default extension directory depends on

  • whether PHP has been built with --enable-debug or not

  • whether PHP has been built with (experimental) ZTS (Zend Thread Safety) support or not

  • the current internal ZEND_MODULE_API_NO (Zend internal module API number, which is basically the date on which a major module API change happened, e.g. 20010901)

Taking into account the above, the directory then defaults to <install-dir>/lib/php/extensions/ <debug-or-not>-<zts-or-not>-ZEND_MODULE_API_NO, e.g. /usr/local/php/lib/php/extensions/debug-non-zts-20010901 or /usr/local/php/lib/php/extensions/no-debug-zts-20010901.

Return Values

Returns TRUE on success or FALSE on failure. If the functionality of loading modules is not available (see Note) or has been disabled (either by turning it off enable_dl or by enabling safe mode in php.ini) an E_ERROR is emitted and execution is stopped. If dl() fails because the specified library couldn't be loaded, in addition to FALSE an E_WARNING message is emitted.

Examples

Example 1. dl() examples

<?php
// Example loading an extension based on OS
if (!extension_loaded('sqlite')) {
    if (
strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
        
dl('php_sqlite.dll');
    } else {
        
dl('sqlite.so');
    }
}

// Or, the PHP_SHLIB_SUFFIX constant is available as of PHP 4.3.0
if (!extension_loaded('sqlite')) {
    
$prefix = (PHP_SHLIB_SUFFIX === 'dll') ? 'php_' : '';
    
dl($prefix . 'sqlite.' . PHP_SHLIB_SUFFIX);
}
?>

Notes

Note: dl() is not supported in multithreaded Web servers. Use the extensions statement in your php.ini when operating under such an environment. However, the CGI and CLI build are not affected !

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

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

Note: dl() is case sensitive on Unix platforms.

Note: This function is disabled in safe mode.

See Also

Extension Loading Directives
extension_loaded()

Grzejniki
Wycieraczki
kredyt hipoteczny doradca finansowy wrocław
kredyt banki
Koszulki

Another Useful functions:


zend-macro.z-obj-handler | zend-macro.z-obj-handler-pp | zend-macro.z-obj-handler-p | zend-macro.z-obj-handle | zend-macro.z-obj-handle-pp | zend-macro.z-obj-handle-p | zend-api.zend-set-user-opcode-handler | zend-api.zend-get-user-opcode-handler | zend-api.zend-get-std-object-handlers | zend-api.zend-file-handle-dtor | zend-api.zend-destroy-file-handle | zend-api.tsrm-set-new-thread-end-handler | zend-api.tsrm-set-new-thread-begin-handler | ref.readline | internals.pdo.error-handling | install.unix.commandline | install.macosx.bundled | function.xslt-set-scheme-handlers | function.xslt-set-scheme-handler | function.xslt-set-sax-handlers | function.xslt-set-sax-handler | function.xslt-set-error-handler | function.xml-set-unparsed-entity-decl-handler | function.xml-set-start-namespace-decl-handler | function.xml-set-processing-instruction-handler | function.xml-set-notation-decl-handler | function.xml-set-external-entity-ref-handler | function.xml-set-end-namespace-decl-handler | function.xml-set-element-handler | function.xml-set-default-handler | function.xml-set-character-data-handler | function.use-soap-error-handler | function.sybase-set-message-handler | function.sybase-deadlock-retry-count | function.ssh2-sftp-readlink | function.soap-soapserver-handle | function.set-exception-handler | function.set-error-handler | function.session-set-save-handler | function.sdo-das-changesummary-endlogging | function.satellite-load-idl | function.runkit-sandbox-output-handler | function.restore-exception-handler | function.restore-error-handler | function.readlink | function.readline | function.readline-write-history | function.readline-redisplay | function.readline-read-history | function.readline-on-new-line | function.readline-list-history | function.readline-info | function.readline-completion-function | function.readline-clear-history | function.readline-callback-read-char | function.readline-callback-handler-remove | function.readline-callback-handler-install | function.readline-add-history | function.pspell-save-wordlist | function.ovrimos-longreadlen | function.odbc-longreadlen | function.ociloadlob | function.ob-tidyhandler | function.ob-list-handlers | function.ob-inflatehandler | function.ob-iconv-handler | function.ob-gzhandler | function.ob-etaghandler | function.ob-deflatehandler | function.mysqli-set-local-infile-handler | function.msql-fieldlen | function.mb-output-handler | function.imagick-destroyhandle | function.imagick-clonehandle | function.imagedashedline | function.ibase-set-event-handler | function.ibase-free-event-handler | function.hw-getandlock | function.dl | function.dba-handlers | function.curl-multi-remove-handle | function.curl-multi-add-handle | function.curl-copy-handle | features.connection-handling | features.commandline |


PHP is a widely-used general-purpose scripting language that is especially suited for Web development and can be embedded into HTML. If you are new to PHP and want to get some idea of how it works, try the introductory tutorial. After that, check out the online manual, and the example archive sites and some of the other resources available in the links section.