...

View Full Version : php include



unknownx
09-25-2005, 01:17 AM
Hi, have alittle problem with the includes.

- I have a forum, phpbb.
- And lets say an empty .php file

I want to include the forum in the php file, the forum is located, from the root in "/forum/index.php"

And in the php file ive used what my friends say would work.

<? include "forum/index.php"; ?>

But, it didnt work, but if i include only, i.e

<? include "testpage.php"; ?>

then it works, so its probbaly the folder thats the problem

The errors;


Warning: main(./extension.inc) [function.main]: failed to open stream: No such file or directory in /****/****/****/****/www-root/forum/index.php on line 25

Warning: main() [function.include]: Failed opening './extension.inc' for inclusion (include_path='.:') in /****/****/****/****/www-root/forum/index.php on line 25

Warning: main(./common.) [function.main]: failed to open stream: No such file or directory in /****/****/****/****/www-root/forum/index.php on line 26

Warning: main() [function.include]: Failed opening './common.' for inclusion (include_path='.:') in /****/****/****/****/www-root/forum/index.php on line 26

Fatal error: Call to undefined function session_pagestart() in /****/****/****/****/www-root/forum/index.php on line 31

..so what do to :)

JamieR
09-25-2005, 01:26 AM
tried putting a absolute path such as:


<?php include("http://www.yoursite.com/forum/index.php"); ?>
?
Also you're missing the () of the include function ;)

devinemke
09-25-2005, 01:28 AM
And lets say an empty .php file
where? that's the issue. if the file that is calling the include is in the document root of your site then you can simply do:


<?php include('./forum/index.php'); ?>

if the file is elsewhere then you have to specify the absolute path or do:


<?php include($_SERVER['DOCUMENT_ROOT'] . '/forum/index.php'); ?>

cyphix
09-25-2005, 04:01 PM
You are having problems because you included a file that has other includes in it which may be relative to the directory it is in; since you're including it back a directory that is why you are having issues.

unknownx
09-25-2005, 04:02 PM
ive tried all of that, dosnt work.. just decreased the errors:


Warning: main(http://www.****.com/forum/index.php) [function.main]: failed to open stream: Permission denied in /****/****/****/****//www-root/phpbb.php on line 98

Warning: main() [function.include]: Failed opening 'http://www.****.com/forum/index.php' for inclusion (include_path='.:') in /****/****/****/****/www-root/phpbb.php on line 98

And on line 98 is the include stuff you posted.

@devinemke:

yes the empty.php is in the root, like
www-root/empty.php
www-root/forum/index.php


Could it be the servers that bothers?



You are having problems because you included a file that has other includes in it which may be relative to the directory it is in; since you're including it back a directory that is why you are having issues.

hmm k.. anything i can do about it?

*
I tried putting an empty2.php in root/forum/empty2.php

and in root/empty.php i included;

<?php include("http://www.****.com/forum/empty2.php"); ?>
and the empty2.php had no includes in it, got same errors

cyphix
09-25-2005, 04:15 PM
Well you could try setting your "$phpbb_root_path" root path (I think you're using phpBB right?) to any files that set it to your absoloute path to the actual location of the forum root dir...... but; I'm not exactly sure if you can do that without screwing anything else up.. best to ask @ phpbb.com support forums.

unknownx
09-25-2005, 04:17 PM
Well you could try setting your "$phpbb_root_path" root path (I think you're using phpBB right?) to any files that set it to your absoloute path to the actual location of the forum root dir...... but; I'm not exactly sure if you can do that without screwing anything else up.. best to ask @ phpbb.com support forums.


alright ill try that tnx

Kurashu
09-25-2005, 08:04 PM
Also you're missing the () of the include function ;)


Include and require (along with their _once counterparts) are NOT functions. They are command structures. No ()'s are needed.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum