Load Extensions Dynamically in PHP

0
Your rating: None

It is possible to load extension libraries at runtime, if they are not compiled in, using the dl() function.

dl() function expects as a parameter the name of the file containing the library. IN UNIX, it will be filenames ending in .so; and in Windows, filenmames will end in .dll.

An example of a call to dl() is

dl(“php_ftp.dll”);

The above code will dynamically load the FTP extension (on a Windows machine).

You need not specify the directory where the file lives: Instead, you should configure this in the php.ini file. A directive called extension_dir will specify the directory where PHP will
look for libraries to dynamically load.

If you find you are having trouble dynamically loading extensions, then check your php.ini file for the enable_dl directive. If it’s off, you won’t be able to dynamically load extensions.

Generally if the machine you work on is not your own, this might be disabled for security reasons. You also won’t be able to use dl() if PHP is running in safe mode.

Post new comment

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Copy the characters (respecting upper/lower case) from the image.

Cumulus Tag Cloud

Kiran Says

SEO Architect,SEO Specialist reflect my values.

By enduring black hat methods the SEO industry is setting itself up for washout and sleepwalking into oblivion.

Jobs in India