Jump to content

Recommended Posts

Warning: include(C:/Program Files/xampp/htdocs/layout.php) [function.include]: failed to open stream: No such file or directory in C:\Program Files\xampp\htdocs\popo\index.php on line 4

Hi quys can anyone tell me why am I getting this message, Please I am developing a PHP website, so please anyone help thx.

[b]EDIT BY WILDTEEN88 - Please dont use caps in posts this is considered as shouting and is against the forum guidelines. I have converted your caps into lowercase for you. Thank you[/b]
thx for your reply , this i try to be more precise help again please



here what i did , i have two file
1 ) index.php
2) layout.php

script goes like this :
idex.php
<?php
// include the layout file
include $_SERVER['DOCUMENT_ROOT'].
'/layout.php';

// Use the myheader function from layout.php
myheader("Welcome to My Website!");


// Use the footer function from layout.php
footer();
?>

here the layout.php

layout.php
<?php
function myheader($ptitle) {
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body>
<table width="100%" bordercolor="#cccccc">
<tr>
<td clospan="3">&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>
<!---- End Header and Begin Content ---->
<?php
}
function footer(){
?>



<!-- End Content and Begin footer --->
</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table>
</body>
</html>
}
?>

ok these r the script i am trying to run , but i keep getting that message that i posted eralier
(function.include) include $_SERVER[DOCUMENT_ROOT] . saying like can't find the the function
so please anyone again help me solve this ,



have you checked your server (using FTP or whatever) to make sure the file is definitely there and in the right place? is your document_root set up properly?

put a line at the top of your code saying: echo $_SERVER['DOCUMENT_ROOT']; and let me know what the result is.
[!--quoteo(post=357753:date=Mar 23 2006, 03:09 PM:name=redbullmarky)--][div class=\'quotetop\']QUOTE(redbullmarky @ Mar 23 2006, 03:09 PM) [snapback]357753[/snapback][/div][div class=\'quotemain\'][!--quotec--]
have you checked your server (using FTP or whatever) to make sure the file is definitely there and in the right place? is your document_root set up properly?

put a line at the top of your code saying: echo $_SERVER['DOCUMENT_ROOT']; and let me know what the result is.
[/quote]

thx for replying redbullmarky , when i put ' echo $_SERVER['DOCUMENT_ROOT']; and run it , it give me that
: C:/Program Files/xampp/htdocs

help me please guys , thx i will be waiting for your reply thx
[!--quoteo(post=357517:date=Mar 23 2006, 10:12 AM:name=apprentice webmaster)--][div class=\'quotetop\']QUOTE(apprentice webmaster @ Mar 23 2006, 10:12 AM) [snapback]357517[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Warning: include(C:/Program Files/xampp/htdocs/layout.php) [function.include]: failed to open stream: No such file or directory in C:\Program Files\xampp\htdocs\popo\index.php on line 4
[/quote]
Where is your file layout.php?
In
C:\Program Files\xampp\htdocs\popo\layout.php
or
C:\Program Files\xampp\htdocs\layout.php
[!--quoteo(post=357878:date=Mar 24 2006, 06:01 AM:name=Honoré)--][div class=\'quotetop\']QUOTE(Honoré @ Mar 24 2006, 06:01 AM) [snapback]357878[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Where is your file layout.php?
In
C:\Program Files\xampp\htdocs\popo\layout.php
or
C:\Program Files\xampp\htdocs\layout.php
[/quote]

thx for replying Honore , my layout.php is inside the site folder :

like-----> C:\Program Files\xampp\htdocs\popo\layout.php

is it right ?
i am online now , so guys help me out . thx
[!--quoteo(post=357882:date=Mar 24 2006, 01:16 PM:name=apprentice webmaster)--][div class=\'quotetop\']QUOTE(apprentice webmaster @ Mar 24 2006, 01:16 PM) [snapback]357882[/snapback][/div][div class=\'quotemain\'][!--quotec--]
my layout.php is inside the site folder :

like-----> C:\Program Files\xampp\htdocs\popo\layout.php
[/quote]
Then use
[code]
// include the layout file
include $_SERVER['DOCUMENT_ROOT'].
'/popo/layout.php';
[/code]
[!--quoteo(post=357885:date=Mar 24 2006, 06:22 AM:name=Honoré)--][div class=\'quotetop\']QUOTE(Honoré @ Mar 24 2006, 06:22 AM) [snapback]357885[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Then use
[code]
// include the layout file
include $_SERVER['DOCUMENT_ROOT'].
'/popo/layout.php';
[/code]
[/quote]

thx i am going to try it now , and i will let you know if it work , thx once again
[!--quoteo(post=357887:date=Mar 24 2006, 06:25 AM:name=apprentice webmaster)--][div class=\'quotetop\']QUOTE(apprentice webmaster @ Mar 24 2006, 06:25 AM) [snapback]357887[/snapback][/div][div class=\'quotemain\'][!--quotec--]
thx i am going to try it now , and i will let you know if it work , thx once again
[/quote]

thx very much Honore , but i have a question , tell me which approch is better , creating a website begining with template meaning everything is link to it , or having an application_top , applicatio_bottom and a configs.inc , so tell me which one is better guys , thx you all for the help you guys provided me , reply if you have any input thx guys
[!--quoteo(post=357894:date=Mar 24 2006, 11:50 AM:name=apprentice webmaster)--][div class=\'quotetop\']QUOTE(apprentice webmaster @ Mar 24 2006, 11:50 AM) [snapback]357894[/snapback][/div][div class=\'quotemain\'][!--quotec--]
thx very much Honore , but i have a question , tell me which approch is better , creating a website begining with template meaning everything is link to it , or having an application_top , applicatio_bottom and a configs.inc , so tell me which one is better guys , thx you all for the help you guys provided me , reply if you have any input thx guys
[/quote]

which approach is down to personal preference. i personally use a touch of both in my sites (a template for all pages that defines the layout, and includes to pull in things like my menu, nav, etc) and each page in my site has a config.php. also with my includes, i always use:

[code]
include_once($_SERVER['DOCUMENT_ROOT'].'/myfile.php');
[/code]
for my includes

and i never use ../ when refering to a file (image, another page, etc) as i prefer my pages and files to be relative to the site root rather than to other pages. this way, it doesnt matter if i shift my pages around into and out of subdirectories, they will alwys be able to find the files and links that they need.
[!--quoteo(post=357896:date=Mar 24 2006, 07:04 AM:name=redbullmarky)--][div class=\'quotetop\']QUOTE(redbullmarky @ Mar 24 2006, 07:04 AM) [snapback]357896[/snapback][/div][div class=\'quotemain\'][!--quotec--]
which approach is down to personal preference. i personally use a touch of both in my sites (a template for all pages that defines the layout, and includes to pull in things like my menu, nav, etc) and each page in my site has a config.php. also with my includes, i always use:

[code]
include_once($_SERVER['DOCUMENT_ROOT'].'/myfile.php');
[/code]
for my includes

and i never use ../ when refering to a file (image, another page, etc) as i prefer my pages and files to be relative to the site root rather than to other pages. this way, it doesnt matter if i shift my pages around into and out of subdirectories, they will alwys be able to find the files and links that they need.
[/quote]

thx for the input redbullmarky really appreciate it , anymore input guys
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.