CodeIgniter Forums
URL file-access is disabled - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forum-21.html)
+--- Thread: URL file-access is disabled (/thread-32638.html)



URL file-access is disabled - El Forum - 07-29-2010

[eluser]NMTeck[/eluser]
I get the below message from my server when trying to run the file_get_contents function. I've looked in over forums and it says that the most likely culprit is in the php.ini file. I made those suggested changes but nothing changed.

These are the settings in my php.ini
Code:
allow_url_fopen    On    On
allow_url_include    On    On


but I still get this

Code:
A PHP Error was encountered

Severity: Warning

Message: file_get_contents() [function.file-get-contents]: URL file-access is disabled in the server configuration

Filename: models/searchmodel.php

Line Number: 490
A PHP Error was encountered

Severity: Warning

Message: file_get_contents(http://maps.google.com/maps/geo?output=xml&key=ABQIAAAAzZoMtPDzv4TIouh7GY2jMRRcFci_9iHLeYmKqMnqyHS75Jm3GRSfps4mjOYSC76MgZ-bm-_m4mcMMQ&q=2418+State+St.,+Chester,+Illinois,+62233&oe=utf8) [function.file-get-contents]: failed to open stream: no suitable wrapper could be found

Filename: models/searchmodel.php

Line Number: 490


However, if I put file_get_contents in a file that doesn't run through CI, I do not get the errors above. Can anyone help me figure out what I'm doing wrong here?

Thanks in advance.


URL file-access is disabled - El Forum - 07-29-2010

[eluser]danmontgomery[/eluser]
[quote author="NMTeck" date="1280443047"]However, if I put file_get_contents in a file that doesn't run through CI, I do not get the errors above. Can anyone help me figure out what I'm doing wrong here?

Thanks in advance.[/quote]

Does it work? Or do you just not get the error message?


URL file-access is disabled - El Forum - 07-29-2010

[eluser]NMTeck[/eluser]
Yes it works and I'm able to print the XML to the screen.

And I guess I should note that I just changed servers.


URL file-access is disabled - El Forum - 07-31-2010

[eluser]NMTeck[/eluser]
Fixed. Just wanted to note that I got around this problem using the curl function instead of file_get_contents or the simplexml_load_file.

Hope this helps others in the future.


URL file-access is disabled - El Forum - 07-31-2010

[eluser]skunkbad[/eluser]
Does anything in the php.ini work? Some hosting environments are set up in a way that php.ini files don't work. My host is this way. I have to use php_value in my .htaccess.