From f227e5fae4fe3e025a49d85443872f34c0c05301 Mon Sep 17 00:00:00 2001 From: Olly Betts Date: Tue, 4 May 2021 08:05:04 +1200 Subject: [PATCH] Document extension=modulename This works for PHP >= 7.2 and is the recommended method now as it avoids having to specify a filename which varies between platforms. --- Doc/Manual/Php.html | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/Doc/Manual/Php.html b/Doc/Manual/Php.html index ad6192a28..e31802c02 100644 --- a/Doc/Manual/Php.html +++ b/Doc/Manual/Php.html @@ -139,18 +139,26 @@ least work for Linux though):

To test the extension from a PHP script, you first need to tell PHP to -load it. To do this, add a line like this to the [PHP] section of -php.ini: +load it. Assuming you're using PHP 7.2 or higher, the recommended (and +simplest!) way to do this is to copy it to PHP's default extension directory +and add a line like this to the [PHP] section of php.ini:

-        extension=/path/to/modulename.so
+        extension=modulename
 

-If the module is in PHP's default extension directory, you can omit the path. +PHP < 7.2 doesn't support loading by just the module name, so you need +to specify the filename of the module to be specified, which varies +between platforms. And for any PHP version, if the module is not in PHP's +default extension directory, you also need to specify the path, for example:

+
+	extension=/path/to/modulename.so
+
+

If you're using the PHP CLI SAPI it's possible (but not recommended) to use the dl() function to @@ -166,8 +174,8 @@ PHP script which uses your extension: But to do this portably you need to take into account that pathnames and the filename extension vary by platform, and for security reasons PHP no longer supports dl() when running PHP through a webserver. Overall it's -probably better to instead use extension in php.ini as -described above. +better to instead use extension in php.ini as described +above.