Page 1 of 2

include file, not working :S

Posted: Tue Feb 07, 2006 9:21 am
by gaogier
this php code is not working

Code: Select all

<?php 
include_once ('header.inc'); 

?>
even if i add the http://www.runehints.com/header it dont work

but it works if its on the same directory, anyone know a way i can get around this?

Posted: Tue Feb 07, 2006 9:23 am
by feyd
use relative pathing, absolute pathing, or update your include_path.

get_include_path()
set_include_path()

Posted: Tue Feb 07, 2006 9:23 am
by malcolmboston
ive always used relative filepaths,

for eg

Code: Select all

// directory above
require ('includes/header.php');
//directory below
require ('../header.php');
use require, your script will die if its not found

Posted: Tue Feb 07, 2006 9:33 am
by gaogier
ok....none of this is working

Posted: Tue Feb 07, 2006 9:34 am
by malcolmboston
try

Code: Select all

error_reporting(E_ALL);
// directory above
require ('includes/header.php');
//directory below
require ('../header.php');
what does it say?

also check file / folder permissions

Posted: Tue Feb 07, 2006 9:38 am
by gaogier
nothing, it says nothing, and i dont have a clue why

its like php dosent work on it

Posted: Tue Feb 07, 2006 9:41 am
by malcolmboston
in the include file put this

Code: Select all

print "I have succesfully loaded the include file";
does it print?

Posted: Tue Feb 07, 2006 9:45 am
by gaogier
you mean dose it show? no

Posted: Tue Feb 07, 2006 9:49 am
by malcolmboston
hmm not really to sure where to go from here.....it is highly unlikely to be the case but have a check on 'open_basedir'
also are you absolutely sure that nothing it being executed before this? IE no db calls no session_start(), absolutely nothing


also view source and list whats there

Posted: Tue Feb 07, 2006 9:56 am
by gaogier
the php code is there, but it works on another directorys

Posted: Tue Feb 07, 2006 9:59 am
by malcolmboston
have you checked file permissions?

Posted: Tue Feb 07, 2006 10:00 am
by gaogier
yeap, al the permisions are the same

Posted: Tue Feb 07, 2006 10:05 am
by gaogier
ok, all has suddenly started to work, i dont understand why, but atleast its working


got a few errors, as its now in a different place, is there a way i can fix all the errors without having to change the code

Posted: Tue Feb 07, 2006 10:08 am
by feyd
would hlep to know the errors. :?

Posted: Tue Feb 07, 2006 10:16 am
by gaogier
i think its errors where its not connecting to the databases, Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/gaogier/public_html/footer.inc on line 315

but it still works on the root