include file, not working :S

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

gaogier
Forum Contributor
Posts: 391
Joined: Wed Mar 02, 2005 1:02 pm
Location: Portsmouth, UK
Contact:

include file, not working :S

Post 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?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

use relative pathing, absolute pathing, or update your include_path.

get_include_path()
set_include_path()
malcolmboston
DevNet Resident
Posts: 1826
Joined: Tue Nov 18, 2003 1:09 pm
Location: Middlesbrough, UK

Post 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
gaogier
Forum Contributor
Posts: 391
Joined: Wed Mar 02, 2005 1:02 pm
Location: Portsmouth, UK
Contact:

Post by gaogier »

ok....none of this is working
malcolmboston
DevNet Resident
Posts: 1826
Joined: Tue Nov 18, 2003 1:09 pm
Location: Middlesbrough, UK

Post 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
gaogier
Forum Contributor
Posts: 391
Joined: Wed Mar 02, 2005 1:02 pm
Location: Portsmouth, UK
Contact:

Post by gaogier »

nothing, it says nothing, and i dont have a clue why

its like php dosent work on it
malcolmboston
DevNet Resident
Posts: 1826
Joined: Tue Nov 18, 2003 1:09 pm
Location: Middlesbrough, UK

Post by malcolmboston »

in the include file put this

Code: Select all

print "I have succesfully loaded the include file";
does it print?
gaogier
Forum Contributor
Posts: 391
Joined: Wed Mar 02, 2005 1:02 pm
Location: Portsmouth, UK
Contact:

Post by gaogier »

you mean dose it show? no
malcolmboston
DevNet Resident
Posts: 1826
Joined: Tue Nov 18, 2003 1:09 pm
Location: Middlesbrough, UK

Post 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
gaogier
Forum Contributor
Posts: 391
Joined: Wed Mar 02, 2005 1:02 pm
Location: Portsmouth, UK
Contact:

Post by gaogier »

the php code is there, but it works on another directorys
malcolmboston
DevNet Resident
Posts: 1826
Joined: Tue Nov 18, 2003 1:09 pm
Location: Middlesbrough, UK

Post by malcolmboston »

have you checked file permissions?
gaogier
Forum Contributor
Posts: 391
Joined: Wed Mar 02, 2005 1:02 pm
Location: Portsmouth, UK
Contact:

Post by gaogier »

yeap, al the permisions are the same
gaogier
Forum Contributor
Posts: 391
Joined: Wed Mar 02, 2005 1:02 pm
Location: Portsmouth, UK
Contact:

Post 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
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

would hlep to know the errors. :?
gaogier
Forum Contributor
Posts: 391
Joined: Wed Mar 02, 2005 1:02 pm
Location: Portsmouth, UK
Contact:

Post 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
Post Reply