the apprentice webmaster Posted March 23, 2006 Share Posted March 23, 2006 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 4Hi 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] Quote Link to comment Share on other sites More sharing options...
ToonMariner Posted March 23, 2006 Share Posted March 23, 2006 Yes.Either the file does not exist or the path is incorrect or there is some permission problem (but think that last one would be specified if it were the case) Quote Link to comment Share on other sites More sharing options...
the apprentice webmaster Posted March 23, 2006 Author Share Posted March 23, 2006 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.phpscript 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<?phpfunction 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"> </td></tr><tr><td> </td><td><!---- End Header and Begin Content ----><?php}function footer(){?><!-- End Content and Begin footer ---></td><td> </td></tr><tr><td> </td><td> </td><td> </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 , Quote Link to comment Share on other sites More sharing options...
redbullmarky Posted March 23, 2006 Share Posted March 23, 2006 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 Link to comment Share on other sites More sharing options...
the apprentice webmaster Posted March 24, 2006 Author Share Posted March 24, 2006 [!--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 Quote Link to comment Share on other sites More sharing options...
Honoré Posted March 24, 2006 Share Posted March 24, 2006 [!--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?InC:\Program Files\xampp\htdocs\popo\layout.phporC:\Program Files\xampp\htdocs\layout.php Quote Link to comment Share on other sites More sharing options...
the apprentice webmaster Posted March 24, 2006 Author Share Posted March 24, 2006 [!--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?InC:\Program Files\xampp\htdocs\popo\layout.phporC:\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 Quote Link to comment Share on other sites More sharing options...
Honoré Posted March 24, 2006 Share Posted March 24, 2006 [!--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 fileinclude $_SERVER['DOCUMENT_ROOT'].'/popo/layout.php';[/code] Quote Link to comment Share on other sites More sharing options...
the apprentice webmaster Posted March 24, 2006 Author Share Posted March 24, 2006 [!--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 fileinclude $_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 Quote Link to comment Share on other sites More sharing options...
the apprentice webmaster Posted March 24, 2006 Author Share Posted March 24, 2006 [!--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 Quote Link to comment Share on other sites More sharing options...
redbullmarky Posted March 24, 2006 Share Posted March 24, 2006 [!--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 includesand 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 Link to comment Share on other sites More sharing options...
the apprentice webmaster Posted March 24, 2006 Author Share Posted March 24, 2006 [!--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 includesand 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.