Skip to Main Content
PHP in a Nutshell
book

PHP in a Nutshell

by Paul Hudson
October 2005
Intermediate to advanced content levelIntermediate to advanced
372 pages
11h 35m
English
O'Reilly Media, Inc.
Content preview from PHP in a Nutshell

Name

dl()

Synopsis

    int dl ( string extension_name )

Use the dl() function to load an extension at runtime, passing the name of the extension to load as its only parameter. Note that there are cross-platform considerations to using dl() that are discussed later. The downside to using dl() is that it needs to dynamically load and unload the extension each time your scripts run—this ends up being a great deal slower than running PHP as a web server module, where the extensions are loaded just once and kept in memory.

One last warning: using dl() with multithreaded web servers (such as Apache 2) will simply not work; you will need to use the static method of editing your php.ini file and restarting the server.

Here is an example of dl() on both Windows and Unix:

    dl('php_imap.dll'); // Windows
    dl('imap.so'); // Unix
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

PHP Cookbook

PHP Cookbook

Eric A. Mann
Programming PHP

Programming PHP

Rasmus Lerdorf, Kevin Tatroe
Learning PHP

Learning PHP

David Sklar

Publisher Resources

ISBN: 0596100671Errata Page