PHP include

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
btpwebdev
Forum Newbie
Posts: 5
Joined: Fri Apr 07, 2006 3:45 pm

PHP include

Post by btpwebdev »

Hi,
I had a website on Streamlinenet and now have moved to a new host using a VPS.
after copying all of files accross via ftp, the files that use the include command dont seem to be working. When i do a php include the file that was meant to be included just gets ignored.
User avatar
aeav
Forum Newbie
Posts: 9
Joined: Fri Apr 28, 2006 7:01 am
Location: Brasil
Contact:

Post by aeav »

try to see the php.ini config, the variable GLOBALS have to be turned ON.
I think that it's the problem, or the variable already´s ON?
btpwebdev
Forum Newbie
Posts: 5
Joined: Fri Apr 07, 2006 3:45 pm

Post by btpwebdev »

Hi,
I am having a slight problem finding the php.ini file at the moment, I am using Plesk which is new for me so it may take a bit of time to get there.

I have noticed that i can include a document that isnt hosted on this server (eg include'google.com...) but none from this server.
User avatar
aeav
Forum Newbie
Posts: 9
Joined: Fri Apr 28, 2006 7:01 am
Location: Brasil
Contact:

Post by aeav »

well, I don't know about include files of another server I think that's impossible, but you can find the php.ini with the shell, try to type this command in the shell:
find / -name php.ini
or
updatedb
locate php.ini

With you're using a VPS with Windows, I don't know how to find the file with ms-dos.. :(
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

How are you calling include and are you sure that all of your included files are there? Also, check your paths to the included files to make sure they resolve correctly. And lastly, is your new server the same set up as your old server?
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

php has a include_path setting... Probably it's different on your localhost and the one of your provider...

Code: Select all

<?php
ini_set('error_reporting', E_ALL);
ini_set('display_errors', TRUE);

require('myfile.php');

echo 'your include_path setting is: ' . ini_get('include_path');

?>
User avatar
aeav
Forum Newbie
Posts: 9
Joined: Fri Apr 28, 2006 7:01 am
Location: Brasil
Contact:

Post by aeav »

good observation I forgot it...

Same servers work a path like this:

include("other_file.php");

And some servers just work like this:

include("./other_file.php");

Is a stupid example, but it's true
btpwebdev
Forum Newbie
Posts: 5
Joined: Fri Apr 07, 2006 3:45 pm

Post by btpwebdev »

Hi,
Thanks,
it worked, i had to change everything from
include("http://www.bigtreeproject.com/directory/header.php")
to
include("./directory/header.php");
It is quite annoying as ill have to change it in every file, but thanks every1!!

Chris.
Post Reply