From c43f84af025b3059e1e76c53c3d4093d2fd7487d Mon Sep 17 00:00:00 2001 From: Olly Betts Date: Tue, 12 Aug 2014 14:45:54 +1200 Subject: [PATCH] Improve PHP docs about extension= and dl() --- Doc/Manual/Php.html | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/Doc/Manual/Php.html b/Doc/Manual/Php.html index 3e7cf54db..cc03f7498 100644 --- a/Doc/Manual/Php.html +++ b/Doc/Manual/Php.html @@ -113,13 +113,7 @@ more detail in section 27.2.6.

The usual (and recommended) way is to build the extension as a separate dynamically loaded module (which is supported by all modern operating -systems). You can then specify that this be loaded -automatically in php.ini or load it explicitly for any script which -needs it. As of version 5.3 of PHP, the dl() -function cannot be used and your only option is to -add to the php.ini something like - -extension = /usr/lib64/php/modules/mymodule.so +systems).

@@ -147,10 +141,9 @@ least work for Linux though):

34.1.2 Using PHP Extensions

-

-To test the extension from a PHP script, you need to load it first. You -can load it for every script by adding this line to the [PHP] section of +To test the extension from a PHP script, you first need to load tell PHP to +load it. To do this, add a line like this to the [PHP] section of php.ini:

@@ -159,8 +152,14 @@ can load it for every script by adding this line to the [PHP] section o

-Alternatively, you can load it explicitly only for scripts which need it -by adding this line to the start of each such PHP script:: +If the module is in PHP's default extension directory, you can omit the path. +

+ +

+For some SAPIs (for example, the CLI SAPI) you can instead use the +dl() function to load +an extension at run time, by adding a like like this to the start of each +PHP script which uses your extension:

@@ -168,14 +167,25 @@ by adding this line to the start of each such PHP script::
 

-SWIG also generates a php module, which -attempts to do the dl() call for you: +But note that this doesn't work when running PHP through a webserver in PHP5.3 +and later - you'll need to use extension in php.ini as +described above. +

+ +

+The PHP module which SWIG generates will also attempt to do the dl() +call for you if the extension isn't already loaded:

 	include("example.php");
 
+

+This PHP module also defines the PHP classes for the wrapped API, so you'll +almost certainly want to include it anyway. +

+

34.2 Basic PHP interface