include_path in php.ini; wondeering how it affects things

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
NewfieBilko
Forum Contributor
Posts: 189
Joined: Sun Jun 06, 2004 6:45 pm
Location: Newfoundland
Contact:

include_path in php.ini; wondeering how it affects things

Post by NewfieBilko »

Hey guys, i am pretty newb when it comes to php. Anyway, can someone inform me on this magical include_path? is it just referencing my root directory to my php web folders? can it have any significance when coding? do tell!1
User avatar
JAM
DevNet Resident
Posts: 2101
Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:

Post by JAM »

can it have any significance when coding
Depending on what type of coding you are doing.

Lets take the example of database abstraction layers. If you have 'your perfect code' that you allways tend to use, that you feel comfortable with, you can move that file (say db.php) into the auto_includes directory. That way, you can include/require the same file from anywhere within the tree structure of your site(s) without having to keep a copy within each of the projects folders.

There is also the thought of security involved. The files is only (so I really hope) available to PHP, meaning that a user cannot type in it's location in their browser to get to the file for whatever reason they want that.
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post by pickle »

The include path is where PHP first looks for a file when you include a file. So, if in any file, say you include('db.php'). PHP will first look in your include path to see if there's a file called db.php. If there is, it includes it, if not, it tries to include a db.php file in the relative location.

You can include files that are stored in your include path from any place on your server, without have to explicitly list it's absolute path.

Make sense?
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
User avatar
NewfieBilko
Forum Contributor
Posts: 189
Joined: Sun Jun 06, 2004 6:45 pm
Location: Newfoundland
Contact:

Post by NewfieBilko »

totally
User avatar
NewfieBilko
Forum Contributor
Posts: 189
Joined: Sun Jun 06, 2004 6:45 pm
Location: Newfoundland
Contact:

Post by NewfieBilko »

Guys, how about the extension_dir?

I am using virtual hosts.

Guess what.. I came into work this morning, after leaving yesterday and everything was fine- but low and behond, My system wasn't work. It says DB: Database Not Found when u naviagte it. When i run debug i get the same error. Although I can connect through navicat, but cannot through php myadmin. so it makes you think its something code side
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

did you remove the include for "." ? That may be the problem...
User avatar
NewfieBilko
Forum Contributor
Posts: 189
Joined: Sun Jun 06, 2004 6:45 pm
Location: Newfoundland
Contact:

Post by NewfieBilko »

Here are my exact settings in the php.ini
This was edited yesterday, but I have put everything back to the way it was , I think.....


;UNIX: "/path1:/path2"
include_path = ".:/php/includes" (commenting gone)
;Windows: "\path1;\path2"
; include_path=".;c:\php\includes


I dont even know if i need this to be on.. I dont rmemeber if i had include path uncommented or not.

and my extension_dir = "/user/lib/php4" this is where i found mysql.so and 2 other .so files... should theree be quotes "" on this?


....... help :(
Last edited by NewfieBilko on Thu Jul 22, 2004 11:08 am, edited 1 time in total.
User avatar
NewfieBilko
Forum Contributor
Posts: 189
Joined: Sun Jun 06, 2004 6:45 pm
Location: Newfoundland
Contact:

Post by NewfieBilko »

i keep getting god damn:

DB Error: not found


i think i <span style='color:blue' title='I&#39;m naughty, are you naughty?'>smurf</span> my application when i <span style='color:blue' title='I&#39;m naughty, are you naughty?'>smurf</span> with the php.ini yesterday.. i think i have everything restored.. check the post above and check me thx
Post Reply