O'Reilly logo

Core PHP Programming, Third Edition by Leon Atkinson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

28.10. Don't Load Extensions Dynamically

The dl function allows applications to dynamically load extensions into PHP, thereby adding functionality to the PHP engine. It is the runtime equivalent of extension=/path/to/extension.so in php.ini. However, using dl has many drawbacks over using php.ini. We strongly encourage you not use it.

Dynamically loading a library for each script execution is much slower than doing it once on server startup. You're actually getting hurt twice, because if you load it using the extension directive in php.ini, it gets loaded once for all of the Web server processes instead of being loaded for each process separately.

Due to the nature of memory management under UNIX, loading an extension once on server startup is ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required