Jump to content

[SOLVED] include() and include_path


ags131

Recommended Posts

I am trying to build a website with php. I am new to php, the only experience i have with php is setting up a zencart site. I have used asp, javascript, and also have programmed in vb.net.

I am trying to include four pages into my index.php Here is the inclusion code:

 

include("lwca\\incudes\\header_html.php");
include("\\incudes\\header.php");
include("\\includes\\menu.php");
include("\\incudes\\footer.php");

 

The site is located at: C:\xampp2\htdocs\lwca

i access it at http://localhost/lwca

i have tried with single backslashes, without leading \, and with and without lwca on front.

 

here is the include line from php.ini

include_path = ".;C:\xampp2\php\pear\;C:\xampp2\htdocs\;.\"

 

Here is what my browser is showing me:

Warning: include(lwca\incudes\header_html.php) [function.include]: failed to open stream: No such file or directory in C:\xampp2\htdocs\lwca\index.php on line 6

 

Warning: include() [function.include]: Failed opening 'lwca\incudes\header_html.php' for inclusion (include_path='.;C:\xampp2\php\pear\;C:\xampp2\htdocs\;.\') in C:\xampp2\htdocs\lwca\index.php on line 6

 

Warning: include(\incudes\header.php) [function.include]: failed to open stream: No such file or directory in C:\xampp2\htdocs\lwca\index.php on line 7

 

Warning: include() [function.include]: Failed opening '\incudes\header.php' for inclusion (include_path='.;C:\xampp2\php\pear\;C:\xampp2\htdocs\;.\') in C:\xampp2\htdocs\lwca\index.php on line 7

 

Warning: include(\includes\menu.php) [function.include]: failed to open stream: No such file or directory in C:\xampp2\htdocs\lwca\index.php on line 8

 

Warning: include() [function.include]: Failed opening '\includes\menu.php' for inclusion (include_path='.;C:\xampp2\php\pear\;C:\xampp2\htdocs\;.\') in C:\xampp2\htdocs\lwca\index.php on line 8

 

Warning: include(\incudes\footer.php) [function.include]: failed to open stream: No such file or directory in C:\xampp2\htdocs\lwca\index.php on line 11

 

Warning: include() [function.include]: Failed opening '\incudes\footer.php' for inclusion (include_path='.;C:\xampp2\php\pear\;C:\xampp2\htdocs\;.\') in C:\xampp2\htdocs\lwca\index.php on line 11

Link to comment
https://forums.phpfreaks.com/topic/172761-solved-include-and-include_path/
Share on other sites

I found out what was wrong. I had misspelled includes and also didn't have lwca on the correctly spelled entry. My code now reads:

 

include("lwca\\includes\\header_html.php");
include("lwca\\includes\\header.php");
include("lwca\\includes\\menu.php");
include("lwca\\includes\\footer.php");

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.