Page 1 of 1
Config.inc doesn't work..
Posted: Thu Apr 01, 2004 5:07 pm
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?
Posted: Thu Apr 01, 2004 5:18 pm
by magicrobotmonkey
what server are you on?
Posted: Thu Apr 01, 2004 5:26 pm
by seeker2921
Apache
Posted: Thu Apr 01, 2004 5:28 pm
by magicrobotmonkey
wait, in config.inc do you surround it with <?php ?> tags?
Posted: Thu Apr 01, 2004 5:42 pm
by seeker2921
I've tried that and I've also tried it without the php tags..
Posted: Thu Apr 01, 2004 9:40 pm
by Pozor
Hello,
and why you dont name them .inc.php -> this is a very common way to name include files... ?
greez Pozor
Posted: Thu Apr 01, 2004 10:12 pm
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.
Posted: Thu Apr 01, 2004 10:23 pm
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
Posted: Thu Apr 01, 2004 10:38 pm
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!
Posted: Fri Apr 02, 2004 12:50 am
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');
Posted: Fri Apr 02, 2004 1:02 am
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.
Posted: Fri Apr 02, 2004 1:18 am
by seeker2921
Do you mean add the path in the config file of where the config file is? if so how?