[thelist] PHP Functions

Jon Molesa rjmolesa at consoltec.net
Tue Dec 30 15:09:36 CST 2008

There are several ways to include external php scripts.  The method your
describing sounds like it could be achieved by setting an include_path
in your php.ini file.  It's a colon separated list of paths.  This would
have to be an absolute path.  Likewise the include statement in a php
script can be a relative path or an absolute path.


If I wanted to have a global library of php functions avaiable at
/var/mylibs/php/, I would define in in my php.ini file as

include_path = ".:/var/mylibs/php:/usr/share/php"

As I mentioned the various paths are separated by colons so the above
translates to:

. = current working directory of running php script
/var/mylibs/php = the path to my library of functions
/usr/share/php = is the system default library available on ubuntu

Then you place your script in that directory and reference them like so


And all the functions and classes contained therein are available.

Take a look here to verify I'm passing along good info.


*On Tue, Dec 30, 2008 at 10:36:49PM +1300 Santilal Parbhu <santilal at scorpioneng.co.nz> wrote:

> Date: Tue, 30 Dec 2008 22:36:49 +1300
> From: Santilal Parbhu <santilal at scorpioneng.co.nz>
> Subject: [thelist] PHP Functions
> To: thelist at lists.evolt.org
> X-Mailer: Microsoft Office Outlook, Build 11.0.6353
> Hi
> I am developing a site where there are multiple users.  For convenience I
> have assembled the site so that the scripts used for each user are held in a
> separate folder.  At present I have a master version of each script.  I then
> copy each script, edit it for the each different user, and save it to each
> folder.  This is a bit of a nightmare each time I get a new user.
> I thought it would be more convenient to group all the common functionality
> into user-created PHP functions, store then in a common area, and call them
> from each script as required.  That way I would only need to have one
> version of the common functions.  However, I have scoured the web to find
> out how to do this and come up blank.  I understand that you can use
> "include", but the included script needs to be in the same folder (I think).
> I want to be able to call a function and tell the script where that function
> is stored - i.e. call the function and specify the path to the function.
> Is what I am trying to do achievable, sensible, or is there a better way to
> do this?  Can anyone help me?  I am using PHP4.
> Thanks.
> Santilal Parbhu
> -- 
> * * Please support the community that supports you.  * *
> http://evolt.org/help_support_evolt/
> For unsubscribe and other options, including the Tip Harvester 
> and archives of thelist go to: http://lists.evolt.org 
> Workers of the Web, evolt ! 

Jon Molesa
rjmolesa at consoltec.net
if you're bored or curious

More information about the thelist mailing list