Config.inc doesn't work..

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
seeker2921
Forum Contributor
Posts: 120
Joined: Sat Mar 22, 2003 7:10 pm
Location: Wiesbaden Germany
Contact:

Config.inc doesn't work..

Post by seeker2921 »

Okay so in all of my php pages I have this line:

include('/home/stephen/public_html/site/includes/config.inc');

It has defines, var's, strings, ect.. in it and each page needs something form this file.. But it isn't in cluded I get no error messegaes about the config file itself just the errors about the missing info contained in the config file.. Yet when I chnage the extention to .php and inculde it as a php file it works.. Why can't I call the file config.inc?
magicrobotmonkey
Forum Regular
Posts: 888
Joined: Sun Mar 21, 2004 1:09 pm
Location: Cambridge, MA

Post by magicrobotmonkey »

what server are you on?
seeker2921
Forum Contributor
Posts: 120
Joined: Sat Mar 22, 2003 7:10 pm
Location: Wiesbaden Germany
Contact:

Post by seeker2921 »

Apache
magicrobotmonkey
Forum Regular
Posts: 888
Joined: Sun Mar 21, 2004 1:09 pm
Location: Cambridge, MA

Post by magicrobotmonkey »

wait, in config.inc do you surround it with <?php ?> tags?
seeker2921
Forum Contributor
Posts: 120
Joined: Sat Mar 22, 2003 7:10 pm
Location: Wiesbaden Germany
Contact:

Post by seeker2921 »

I've tried that and I've also tried it without the php tags..
Pozor
Forum Commoner
Posts: 74
Joined: Tue Mar 30, 2004 11:11 pm
Location: Switzerland

Post by Pozor »

Hello,

and why you dont name them .inc.php -> this is a very common way to name include files... ?

greez Pozor
kettle_drum
DevNet Resident
Posts: 1150
Joined: Sun Jul 20, 2003 9:25 pm
Location: West Yorkshire, England

Post by kettle_drum »

Does apache make php parse .inc files?

But in all honesty its just a file extension whats wrong with just .php, or as pozor said just call it file.inc.php.

Just make sure php parses it, or somebody can just view it and see all the lovely info about your sql connection details or whatever else you have in the file.
Pozor
Forum Commoner
Posts: 74
Joined: Tue Mar 30, 2004 11:11 pm
Location: Switzerland

Post by Pozor »

Hello,

thats the problem, but you can cofigure the apache that he parse .inc files like .php files. I name my inc files everytime ...inc.php because when you use this files with another server (other provider), maybe the apache doesn't parse .inc files as like .php...


greez Pozor
seeker2921
Forum Contributor
Posts: 120
Joined: Sat Mar 22, 2003 7:10 pm
Location: Wiesbaden Germany
Contact:

Post by seeker2921 »

I will just use the inc.php, I never thought of people being able to view them if they are just inc.. Thanks!
Zay
Forum Newbie
Posts: 22
Joined: Tue Mar 23, 2004 3:42 pm

Post by Zay »

yeah rename as .php...

also you have to give the path FROM the file that includes it, as far as I know...

well that's what I always do, and it always works..

so if you include it from
/home/stephen/public_html/site/

just type
include('includes/config.inc.php');
kettle_drum
DevNet Resident
Posts: 1150
Joined: Sun Jul 20, 2003 9:25 pm
Location: West Yorkshire, England

Post by kettle_drum »

Doing the path like zay said also makes it more cross compatable, as if you move server or account home/stephen/public_html/site/ wont be the path to your files.
seeker2921
Forum Contributor
Posts: 120
Joined: Sat Mar 22, 2003 7:10 pm
Location: Wiesbaden Germany
Contact:

Post by seeker2921 »

Do you mean add the path in the config file of where the config file is? if so how?
Post Reply