Question:
PHP include not working!?
2009-01-27 18:50:40 UTC
When I uploaded the first page ofmy website with the PHP files and previewed the site it showed these errors:

Warning: include() [function.include]: URL file-access is disabled in the server configuration in /home/a5465916/public_html/index2.html on line 12
Warning: include(http://www.painted-dreams.comoj.com/header.php) [function.include]: failed to open stream: no suitable wrapper could be found in /home/a5465916/public_html/index2.html on line 12
Warning: include() [function.include]: Failed opening 'http://www.painted-dreams.comoj.com/header.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/a5465916/public_html/index2.html on line 12
Warning: include() [function.include]: URL file-access is disabled in the server configuration in /home/a5465916/public_html/index2.html on line 71
Warning: include(http://www.painted-dreams.comoj.com/footer.php) [function.include]: failed to open stream: no suitable wrapper could be found in /home/a5465916/public_html/index2.html on line 71
Warning: include() [function.include]: Failed opening 'http://www.painted-dreams.comoj.com/footer.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/a5465916/public_html/index2.html on line 71

I don't know what's wrong, I checked line 71 and 12 but I don't know the problem.
Can you please tell me??
And I HAVE the header and footer so yeah. If you want to see for yourself it's at
http://www.painted-dreams.comoj.com/index2.html

thanks~
Four answers:
gitter1226
2009-01-27 18:56:31 UTC
What does your include statement look like? Best I can tell, you're using a fully qualified URL in the include statement. Instead, try using a relative path to the included file.



If this is not the case, give me some code to look at.
thom
2016-10-28 19:32:05 UTC
Php Include Not Working
2009-01-30 09:19:48 UTC
include() should be formatted like




include('something.php'); //Single quote

?>



and you are tying to use a URL for include. You will need to have URL fopen wrappers enabled on the server. It will not work until.\

"If "URL fopen wrappers" are enabled in PHP (which they are in the default configuration), you can specify the file to be included using a URL (via HTTP or other supported wrapper - see List of Supported Protocols/Wrappers for a list of protocols) instead of a local pathname. If the target server interprets the target file as PHP code, variables may be passed to the included file using a URL request string as used with HTTP GET. This is not strictly speaking the same thing as including the file and having it inherit the parent file's variable scope; the script is actually being run on the remote server and the result is then being included into the local script. "
Joseph K
2009-01-27 19:57:38 UTC
Someone, probably your webhost, has disabled allowing includes of url's in includes, a common setting in shared hosting environments.



If your host will change or allows you to set your php.ini settings, you can enable this option.



In php.ini add



allow_url_include = 1


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...