Where to put global includes

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Where to put global includes

Post by Burrito »

I have created a new mail function file called mailer.php. I want to be able to call that function fom any page w/o including that file in the same folder. Where in PHP (for windoze) can I put the file so that it will include it by just using include("mailer.php").

thx for your time,

Burr

btw, my php installation is in c:\php
User avatar
DuFF
Forum Contributor
Posts: 495
Joined: Tue Jun 24, 2003 7:49 pm
Location: USA

Post by DuFF »

Just edit PHP.ini's include_path.

This is how mine looked at first:

Code: Select all

;Windows: "\path1;\path2"
;include_path = ".;c:\php\includes"
So you can just change it to:

Code: Select all

; Windows: "\path1;\path2"
;include_path = ".;c:\php\includes;c:\path\to\folder"
McGruff
DevNet Master
Posts: 2893
Joined: Thu Jan 30, 2003 8:26 pm
Location: Glasgow, Scotland

Post by McGruff »

Using the includes directory is a good option.

Another is to use an absolute path from the web root to the file.
Post Reply