frankbm4 Posted April 21, 2010 Share Posted April 21, 2010 I am new to PHP so I am still learning a great deal. I am trying to launch a big site for a client and one feature was produced by another agency using the Google Maps API. Their site worked okay on their server but when moved to mine running PHP5, I started receiving errors. One of the errors was easily fixed when I found out they had misspelled a path. Once that was fixed, I started getting these errors: Warning: simplexml_load_file() [function.simplexml-load-file]: URL file-access is disabled in the server configuration in/homepages/31/d105746882/htdocs/orlando/smilestories/mapzzz.php on line 106 Warning: simplexml_load_file(http://maps.google.co.uk/maps/geo?q=135+prosperity+dr.%2C+kitchener%2C+ON%2C+Canada&output=xml&key=ABQIAAAAQhy6LNN-OgxmYTZV8VUafBQ77l1TjQNSMBh8EvFIScgmdn95IRR4yOhgg6hALlqfpDzGZYbA-YNDfA) [function.simplexml-load-file]: failed to open stream: no suitable wrapper could be found in/homepages/31/d105746882/htdocs/orlando/smilestories/mapzzz.php on line 106 Warning: simplexml_load_file() [function.simplexml-load-file]: I/O warning : failed to load external entity "http://maps.google.co.uk/maps/geo?q=135+prosperity+dr.%2C+kitchener%2C+ON%2C+Canada&output=xml&key=ABQIAAAAQhy6LNN-OgxmYTZV8VUafBQ77l1TjQNSMBh8EvFIScgmdn95IRR4yOhgg6hALlqfpDzGZYbA-YNDfA" in/homepages/31/d105746882/htdocs/orlando/smilestories/mapzzz.php on line 106 Unfortunately, because I am using a shared server, I have no access to my php.ini file. Here is line 106: $data=simplexml_load_file($URL); When I view my phpinfo.php file, it tells me that the SimpleXML Support is enabled. I have attached the PHP. I hope someone can help. Thanks in advance. -Frank [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/199218-warning-simplexml_load_file-functionsimplexml-load-file/ Share on other sites More sharing options...
oni-kun Posted April 21, 2010 Share Posted April 21, 2010 allow_url_fopen and allow_url_include must be turned on in php.ini (or propriertary .htaccess) before you are able to do this. It was most likely not set up on your server and must be changed by hand. An example .htaccess setup with these values would be: php_value allow_url_fopen 1 php_value allow_url_include 1 This would allow external addresses to be included, Just note the security risks of CSRF and simple file security practises before you enable this. Quote Link to comment https://forums.phpfreaks.com/topic/199218-warning-simplexml_load_file-functionsimplexml-load-file/#findComment-1045563 Share on other sites More sharing options...
frankbm4 Posted April 21, 2010 Author Share Posted April 21, 2010 Thanks for the tip. I'll check my settings and see if that is the issue. -Frank Quote Link to comment https://forums.phpfreaks.com/topic/199218-warning-simplexml_load_file-functionsimplexml-load-file/#findComment-1045566 Share on other sites More sharing options...
frankbm4 Posted April 21, 2010 Author Share Posted April 21, 2010 allow_url_fopen and allow_url_include must be turned on in php.ini (or propriertary .htaccess) before you are able to do this. It was most likely not set up on your server and must be changed by hand. An example .htaccess setup with these values would be: php_value allow_url_fopen 1 php_value allow_url_include 1 This would allow external addresses to be included, Just note the security risks of CSRF and simple file security practises before you enable this. Hello, Oki. Thanks again for your help. When I changed the .htacess the whole page just showed and error. The actual piece comes is accessed through an iframe yet the whole page showed this error: Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, [email protected] and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log. Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request. I changed that back and learned how to create my on php.ini file and I can see by checking my phpinfo page that the settings are being changed though this. However, after changing my setting in the php.ini to enable allow_url_fopen and allow_url_include, I get this error: Warning: implode() [function.implode]: Invalid arguments passed in /homepages/31/d105746882/htdocs/orlando/smilestories/mapzzz.php on line 554 The previous errors I posted before remain. Thanks for any help. -Frank Quote Link to comment https://forums.phpfreaks.com/topic/199218-warning-simplexml_load_file-functionsimplexml-load-file/#findComment-1045576 Share on other sites More sharing options...
frankbm4 Posted April 21, 2010 Author Share Posted April 21, 2010 Oni, your suggestions were correct. I made the changes to the php.ini but it was still not working. Then I realized I needed to move the php.ini file INTO the directory that the the project was in. That fixed it. Thank you very much. -Frank Quote Link to comment https://forums.phpfreaks.com/topic/199218-warning-simplexml_load_file-functionsimplexml-load-file/#findComment-1045756 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.