Teach Yourself PHP in 10 Minutes [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Teach Yourself PHP in 10 Minutes [Electronic resources] - نسخه متنی

Chris Newman

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید






Loadable Modules


PHP allows you to load certain extensions at runtime. This means that you can extend the functionality of PHP without needing to recompile from source.

Loading Extensions on Demand


You use the dl function to dynamically load an extension module. You build extensions as dynamically loadable objects when PHP is compiled, by using the --with-EXTENSION=shared switch. For instance, running the following configure statement causes PHP to be compiled with MySQL support linked in but with socket support as a loadable extension:


./configure --with-mysql --with-sockets=shared

The argument given to dl is the filename of the extension. In the case of the sockets extension, it would be called sockets.so on Linux/Unix but php_sockets.dll on Windows systems.

Loadable Extensions
Whether the dl function is available is governed by the enable_dl directive in php.ini. You may find that on a shared web hosting service, this feature is not available to you.

To check whether an extension is loaded into PHP, you use the extension_loaded function. Given an extension name argument, this function returns trUE or FALSE, depending on the presence of that extension. Note that PHP cannot tell whether an extension was loaded by using dl or is compiled in.

Loading Modules on Startup


If you have extensions as loadable modules and want them to be loaded into PHP without needing to run dl in every script, you can use the extension directive in php.ini to provide a list of extensions to load at startup.

Each extension is given on a separate line, and there is no limit to the number of extensions you can load in this way. The following lines from php.ini ensure that the sockets and imap extensions are loaded automatically on a Linux/Unix server:


extension=imap.so
extension=sockets.so

On a Windows web server, the configuration lines need to look like this, to reflect the difference in filenames between the two platforms:


extension=php_imap.dll
extension=php_sockets.dll


/ 126