getting a error message from my php
I have created a page on my site with the surfix .php {after taking a crash course in php} and I am getting this error message:
Warning: include(): http:// wrapper is disabled in the server configuration by allow_url_include=0 in /home/u259153114/public_html/php_site/about.php on line 12 Warning: include(http://musiccafefriends.neq3.com/php_site/header.php): failed to open stream: no suitable wrapper could be found in /home/u259153114/public_html/php_site/about.php on line 12 Warning: include(): Failed opening 'http://musiccafefriends.neq3.com/php_site/header.php' for inclusion (include_path='.:/usr/lib/php') in /home/u259153114/public_html/php_site/about.php on line 12 Warning: include(/php_site/includes/nav.php): failed to open stream: No such file or directory in /home/u259153114/public_html/php_site/about.php on line 13 Warning: include(): Failed opening '/php_site/includes/nav.php' for inclusion (include_path='.:/usr/lib/php') in /home/u259153114/public_html/php_site/about.php on line 13
so now what I done wrong I love web design and learning new things but this is stressing me out now lol yes I can see it is saying there that these files or directories do not exist but trust me they do all directories and files are in there it seems to me that for some reason the neq3 server is blocking my coding any ideas
This message is rather self explanatory:
include(): http:// wrapper is disabled in the server configuration by allow_url_include=0
means you are trying to include remote file (which is very, very bad idea), like:
include('http://...../file.php');
but (usually for security reasons) this feature is disabled on this server. I'd recommend copy the remote file and include it locally.
You're trying to include a remote file in your script. Instead of doing that, you could just copy the contents of the external file, put it in a file on your server and then include it.
As Orangepill said, the default setting for allow_url_include is to disable it.
Unless I am mistaken, though, it looks like the file you are trying to include is actually on the same server (they both seem to be in a directory called php_site). If that's the case, you can change your include from:
include('http://musiccafefriends.neq3.com/php_site/header.php');
to:
include('header.php');
If they're not hosted on the same server, your best bet is to move the file you want to include onto the server you want to include it on.
allow_url_include
is disabled by default to prevent cross-site scripting, because the code will be evaluated at the other end before it is included on your end, meaning nasty stuff can be injected and run on your server.
As for your second problem:
Failed opening '/php_site/includes/nav.php'
The slash /
at the beginning of the path makes it an "absolute path", so PHP is looking for the file at the root of your filesystem and not finding it. You are looking for a file called 'nav.php' in a folder called 'includes' under the current one. If you change your include to include('includes/nav.php')
, it should work.
上一篇: PHP头已经发送错误,不是空白错误
下一篇: 从我的PHP获取错误消息