tags:

views:

97

answers:

6

I am running the code below in some if/else statements, I have a weird issue in the same file this exact code below works fine, however in another area if it is called I get this error;

Warning: include() [function.include]: URL file-access is disabled in the server configuration in C:\webserver\htdocs\processing\process.friends.php on line 168

Warning: include(http://localhost/index.php) [function.include]: failed to open stream: no suitable wrapper could be found in C:\webserver\htdocs\processing\process.friends.php on line 168

$_SESSION['sess_msg'] = 'Please Enter the Correct Security Code';
$_GET["friendid"] = $friendid;
$_GET["p"] = 'mail.captcha';
$_GET["f"] = 'friend';
include ("index.php");
exit;

And just to clarify I am njot trying to run this code 2 times at the SAME time, it's more like this; Not just like this but you get the point that they are not run at the same time

if(something){
   run the code above
}else{
   run the code above
}

If it matters, I am currently running a LAMP setup on a windows PC

A: 

have you tried include_once(), required_once, required() ? i prefer require_once or include_once ..

your include should be include('http:url');

dassouki
+7  A: 

remove the "http://localhost" part of your code. As a rule of thumb, when you include your own files, you should include them from your file system.

include "./index.php";
Robert Greiner
yeah that is just a test code, it has no affect on it working or not though
jasondavis
Looks like it did fix it, I must of overlooked this before, weird how it's usually the simplest issues that take the most time to fix, usually from overlooking them because they seem simple, thanks
jasondavis
excellent! Glad I could help. Yeah, it is funny how that is true, but you learn alot in the process. Keep going and you'll be a pro in no time.
Robert Greiner
Upvoted both your answer and your comment because of your general supportiveness. =)
David Thomas
thanks @ricebowl I appreciate it.
Robert Greiner
A: 

Well, I don't kow the answer to your question, though I do have to ask why you feel the need to include a URL based file?

include('http://whatever.com/'); can be EXTREMELY dangerous.

If you're just trying to output the HTML generated from that, I'd suggest you do something like echo file_get_contents('http://some/url');. If you're trying to include PHP code, use the system path

Mez
actually it will be (index.php) it just has apth because I am trying every way possible to get it to work right now
jasondavis
+2  A: 

Just remove the http://localhost/ part and you'll be okay.

dutch
that worked, weird, I was just trying every file path possible to get it to work, I don't know how I overlooked that
jasondavis
A: 

Are they EXACTLY the same? Could you post both versions of the code?

I can also recommend not doing an include('http://...'); This will make PHP to an HTTP request to your webserver, and grab the result. You might be a bit better off just doing include('index.php');, if this is possible for your setup.

Evert
A: 

Is allow_url_fopen enabled in php.ini?

Glass Robot