How to stop this error message "Warning: file_get_contents()"
Sometimes this warning message appears
PHP Code:
Warning: file_get_contents() [function.file-get-contents]: URL file-access is disabled in the server configuration in /home/*******/public_html/wp-content/themes/jobroller/includes/theme-functions.php on line 750
Warning: file_get_contents(http://maps.google.com/maps/geo?q=kings+lynn&output=json&language=es®ion=CL) [function.file-get-contents]: failed to open stream: no suitable wrapper could be found in /home/******/public_html/wp-content/themes/jobroller/includes/theme-functions.php on line 750
and it seems like a permissions error. However, the problem is that it clearly says that Host doesn’t allow remote connection? Some hosting providers do not provide "php.ini EZconfig" which causes a problem with PHP 4 and higher as it won't let the commands open urls.
The solution:
1) Access your Cpanel and scroll down to "Software/Services" and click on "php.ini EZconfig".
2) Then click on enable "EZconfig" and scroll down to "allow_url_fopen" and make sure that "on" is selected, also "allow_url_include" should also be on.
If you do not have "php.ini EZconfig" available then do the following:
1) Go to file manager in cpanel and click "ok" then in the top right corner search for "All your files" and type in "php.ini"
2) Open the containing folder and highlight the file "php.ini" and click on "edit" and search for this line of text "allow_url_fopen" around line 496, it should read "allow_url_fopen = On". Also the next line should be "allow_url_include" and this should also be On. If they are "off" change the text to "On"
If "php.ini" does not exeist then do the following:
1) Stay in "file manager" and on the left hand side click on:
(/home/********)
then these folders should show on the right
- access-logs
- etc
- forum-avatars
- logs
- mail
- public_ftp
- public_html
- tmp
- www
2) click "new file" in the top left corner.
In "Create a New File" dialog box type the following-
New File Name:
php.ini
(ex: file.txt, file.html, file.php)
New file will be created in:
/
leave this blank
Then click "create new file"
3) Next highlight the file "php.ini" and click "edit" at the top of the page to open the editor.
type the following code:
allow_url_fopen = On
and click "save changes"
Everything should now be working and you will not get the error message again.