CERN - European Organization for Nuclear Research     IT Division     IS Group  
       Saturday, 18 May 2024
Home Examples

6. "Using a PHP module that is not in the standard PHP distribution"

One of the nice features about PHP is that you hardly ever have to do much programming but there is a wide range of modules available doing almost everything you can imagine. In addition that these modules are usually quite well documented, you can also rely on them being already sufficiently debugged. 

Modules that are not included in the standard PHP distribution can be easily obtained from php.net (Official PHP site). However you have to put them into a location where PHP finds them or tell PHP to look for them where you put them !

i) Create a directory within your Web-site for the additional PHP modules you want to use, call it e.g.  'includes'

ii) Copy the PHP module that into the directory 

ii) From within your php-script you have to include the 'includes' directory to the library search path. Add something similar to the following to your PHP-script:

include( '\Full\path\to\includes' );

Then you can use the 'new' module as any other module, e.g.

include('Mail.php');
include('Mail/mime.php');

# your code to follow ...

 

If you don't specify the correct path in the 'include' statement you will get a quite understandable error message that the 'YourModuleName' module can not be located !!! 
 

 


Continue back to:  PHP Help Home