Jump to content

include("site.php") not working!


essjay_d12

Recommended Posts

I havhttp://www.phpfreaks.com/forums/style_images/1/folder_rte_images/bold.gif
Bolde the following file....

accessKey.php and also tried accessKey.html

[code]
<A accesskey="S"
rel="Advanced Search" href=
"http://localhost/dvdreviewer/advancedSearch.php"
></A>
<A accesskey="H"
rel="Home" href=
"http://localhost/dvdreviewer/default.php"
></A>
[/code]

And then in my default.php file (and planned for every other page on the site)

i have ....

[code]
<body>
<?php include("http://localhost/dvdreviewer/accessKey.php"); ?>

.....code

</body>
[/code]

This at the moment brings back errors on the default.php page...

[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]
Warning: main(http://localhost/dvdreviewer/accessKey.php): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in C:\Program Files\Apache Group\Apache2\htdocs\dvdreviewer\default.php on line 19

Warning: main(): Failed opening 'http://localhost/dvdreviewer/accessKey.php' for inclusion (include_path='.;c:\php4\pear') in C:\Program Files\Apache Group\Apache2\htdocs\dvdreviewer\default.php on line 19
[/quote]

Anyone know why?

Thanks

D
Link to comment
https://forums.phpfreaks.com/topic/5780-includesitephp-not-working/
Share on other sites

i don't think that you can use URL's when including.
you need to specify the path in either of two ways:

relative to the file you have the include in:
include('../scripts/myscript.php');

or relative to the site:
include($_SERVER['DOCUMENT_ROOT'].'/scripts/myscript.php');

paths accepted in include are the full server paths, not URL's.

try it

Cheers
Mark
still getting errors though .. changed it to both

the following error for .. <?php include('../dvdreviewer/accessKey.html'); ?>

.....

Warning: main(C:/Program Files/Apache Group/Apache2/htdocs/dvdreviewer/accessKey.html): failed to open stream: No such file or directory in C:\Program Files\Apache Group\Apache2\htdocs\dvdreviewer\default.php on line 469

Warning: main(): Failed opening 'C:/Program Files/Apache Group/Apache2/htdocs/dvdreviewer/accessKey.html' for inclusion (include_path='.;c:\php4\pear') in C:\Program Files\Apache Group\Apache2\htdocs\dvdreviewer\default.php on line 469
[!--quoteo(post=358274:date=Mar 25 2006, 05:19 PM:name=Essjay_d12)--][div class=\'quotetop\']QUOTE(Essjay_d12 @ Mar 25 2006, 05:19 PM) [snapback]358274[/snapback][/div][div class=\'quotemain\'][!--quotec--]
still getting errors though .. changed it to both

the following error for .. <?php include('../dvdreviewer/accessKey.html'); ?>

.....

Warning: main(C:/Program Files/Apache Group/Apache2/htdocs/dvdreviewer/accessKey.html): failed to open stream: No such file or directory in C:\Program Files\Apache Group\Apache2\htdocs\dvdreviewer\default.php on line 469

Warning: main(): Failed opening 'C:/Program Files/Apache Group/Apache2/htdocs/dvdreviewer/accessKey.html' for inclusion (include_path='.;c:\php4\pear') in C:\Program Files\Apache Group\Apache2\htdocs\dvdreviewer\default.php on line 469
[/quote]

are you 100% that accessKey.html is:
a) in the dvdreviewer folder
b) in the same case as you're specifying? most things like this are case sensitive.

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.