Jump to content

Include Problem


3s2ng

Recommended Posts

Hello Freaks,

My script works before but now its not working. I suspected that the problem was on the includes. I think the includes were not being executed. I can say that the problem was on the includes because currently the includes look like this

include $siteurl."/test.php";

But if i change that include to

include ("../test.php");

it works.

What is wrong with my original include? Can you tell me whats wrong?

the value of $siteurl = "http://www.mydomain.com";

Added info.
register_globals is set to OFF and allow_url_fopen is set to ON.

I hope you can help me.

I dont want to change all the includes to this format: include ("../test.php"); Because I also got a script that access a URL.

ex. include "http://www.otherdomain.com/news.php?tech=php&id=2765";


Thanks,
MARK

Link to comment
https://forums.phpfreaks.com/topic/28493-include-problem/
Share on other sites

You really don't want to use a full URL with the include statement. Doing this causes the include file to be processed by another invocation of the webserver and whatever is defined in said include file gets defined in that context, not your script's context. Use standard filesystem paths with your icludes for local files.

Ken
Link to comment
https://forums.phpfreaks.com/topic/28493-include-problem/#findComment-130584
Share on other sites

Hi Ken,

Thanks for your reply.

But how about if I want to include a file which is on the other domain or server? I'm using this service [url=http://www.news4sites.com/service/newsfeed.php?tech=php&id=13]http://www.news4sites.com/service/newsfeed.php?tech=php&id=13[/url]. this was working before. It maybe a misconfiguration on the php.ini and I need to findout what should be the correct config.

I hope you can help me.
Link to comment
https://forums.phpfreaks.com/topic/28493-include-problem/#findComment-130604
Share on other sites

There is a php.ini setting called "safe mode" that keeps you from including remote files into your scripts...
it's a security vulnerability to disable it, but it's not really hard to avoid unless you play it dumb.

Try seeing if safe mode is enabled, and if it is, disable it... I'd be nervous about including a remote file, but that's just me

http://www.corephp.co.uk/archives/19-Prepare-for-PHP-6.html
safe mode (along with many other things like magic quotes) will be gone in php6


Good luck!
Link to comment
https://forums.phpfreaks.com/topic/28493-include-problem/#findComment-130678
Share on other sites

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.