Question

I hope you all are in the best mood to help me in my problem . Ok now I'm using a free hosting that doesn't allow url_allow_include , my domain is example.com and I wanna include a php file from eample2.com/file.php always when I want to do that it doesn't work , please I don't want answers that says contact your hosting provider to enable it for you. I wanna some trick using curl for example or anything else that will solve my problem and thanks in advance

Was it helpful?

Solution

Sure you don't want to hear it... But still, the answer is contact your hosting provider.

But before you do, let me tell you why you probably shouldn't do so in the first place:

If the PHP file you want to include is included over a url (that is with http:// in front of it) , you will be asking the webserver of example2.com to give you that file. The webserver will then run that file through PHP (thus already parsing that file) and give you the parsed HTML that the script produces. And you will end up including the parsed HTML in stead of the original contents of the PHP file you are trying to include.

If by any chance example.com and example2.com are hosted on the same machine, try including the desired file by using an absolute file path to that file. (eg include "/var/www/example2/yourPHPfile.php";)

OTHER TIPS

Contact your host. Option #1 see if they can change that setting. Option #2 see if you can access the php.ini file and find that option in it and change the value. That's about the best you can do but also try this before both options and see if you get an error. If you do the host is blocking it and probably wont allow you to change it.

ini_set('allow_url_include', "0");
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top