Login to your server via ssh and type
sudo nano /etc/php5/apache2/php.ini //<<<< ubuntu/debian server, might differ for you
in the file, simply press "ctrl + w"
and type "allow_url_fopen"
and Return, most probably you will come to the explanation first, so repeat the search a couple of times. Now you can change the entry from
allow_url_fopen=0
to
allow_url_fopen=1
press "ctrl + x"
and confirm the file save with "y"
.
Then type
sudo service apache2 restart
This will restart apache so the new php.ini configuration can be loaded. After those steps, you should be able to use file_get_contents
externally.
SIDENOTE
If you can’t find your php.ini file, you will find the path to the loaded php.ini file in the top section of your phpinfo()

Related Posts:
- How do I get a YouTube video thumbnail from the YouTube API?
- What’s the net::ERR_HTTP2_PROTOCOL_ERROR about?
- http://localhost:80 is not working on running Apache server through UniServer ZeroXIII
- How do I resolve a HTTP 414 “Request URI too long” error?
- Getting an error when I visit http://localhost
- PHP + curl, HTTP POST sample code?
- Redirect vs RedirectMatch
- Can curl make a connection to any TCP ports, not just HTTP/HTTPS?
- Call to undefined function curl_init().?
- How do I get a YouTube video thumbnail from the YouTube API?
- What is the difference between the ‘www’ folder and ‘htdocs’ folder?
- CURL ERROR: Recv failure: Connection reset by peer – PHP Curl
- What is Options +FollowSymLinks?
- cURL error 60: SSL certificate: unable to get local issuer certificate
- SSL error SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
- curl POST format for CURLOPT_POSTFIELDS
- HTTP Error 411, The request must be chunked or have a content length
- MAMP “Apache couldn’t be started because port is in use.” AND “Can’t connect to local MySQL server through /tmp/mysql.sock
- PHP cURL custom headers
- Only variable references should be returned by reference – Codeigniter
- Connection reset by peer: mod_fcgid: error reading data from FastCGI server
- PHP cURL HTTP PUT
- Error:error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure
- XAMPP, using port:81, cannot run localhost:81/mywebsite
- “End of script output before headers” in Apache + PHP
- How to POST JSON Data With PHP cURL?
- cURL request in Laravel
- How can I force users to access my page over HTTPS instead of HTTP?
- Getting a 500 Internal Server Error on Laravel 5+ Ubuntu 14.04
- Using PHP 7 with WAMP
- How to remove index.php from WordPress site URL
- cURL 28 error after switch from to brew php 7.2 on localhost
- How to set 777 permission on a particular folder? [closed]
- regex match any whitespace
- PHP page redirect
- xajax expanding list query
- Data source name not found, and no default driver specified
- Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, object given in
- How do I redirect a page in jQuery?
- Fatal error: Call to undefined function mysqli_connect()
- Illegal string offset Warning PHP
- What’s the purpose of ini_set() in php? (especially for error reporting)
- Send email with PHP from html form on submit with the same script
- Forbidden :You don’t have permission to access /phpmyadmin on this server
- How do I run a file on localhost?
- How to call a JavaScript function from PHP?
- Print array to a file
- I have a string with “\u00a0”, and I need to replace it with “” str_replace fails
- Finding the number of days between two dates
- MySqli Commands out of sync; you can’t run this command now
- Getting connection failed: php_network_getaddresses: getaddrinfo failed: Name or service not known
- “Cannot send session cache limiter – headers already sent”
- Unable to locate package libapache2-mod-php7
- How to find the date of a day of the week from a date using PHP?
- PHP multidimensional array search by value
- Trying to get property of non-object – Laravel 5
- nginx: connect() failed (111: Connection refused) while connecting to upstream – after update nginx –
- Convert a date format in PHP
- Get user role by ID WordPress
- How to fix syntax error, unexpected T_IF error in php?
- How can I capture the result of var_dump to a string?
- Is Angularjs Clientside or Serverside or Both
- Laravel 5 Class ‘Collective\Html\HtmlServiceProvider’ not found on AWS
- MySQL query to get column names?
- Fatal error: Out of memory, but I do have plenty of memory (PHP)
- Changing permissions via chmod at runtime errors with “Operation not permitted”
- php – How do I fix this illegal offset type error
- Getting ’ instead of an apostrophe(‘) in PHP
- WooCommerce action hooks and overriding templates
- Updating php version on mac
- How to send a GET request from PHP?
- WRONGTYPE Operation against a key holding the wrong kind of value php
- What is the advantage of using try {} catch {} versus if {} else {}
- Check if URL has certain string with PHP
- Subtracting days, months or years from date using php
- Laravel – Model Class not found
- Fatal error: Call to a member function fetch_assoc() on a non-object
- PHP array delete by value (not key)
- PHP mail: Multiple recipients?
- Having a problem getting mysqli_query to execute
- PHP Multiple Checkbox Array
- Session variables not working php
- Get JSON object from URL
- How to push both value and key into PHP array
- Popup window in PHP?
- How can you use php in a javascript function
- How to bypass (deprecated) reCAPTCHA V1?
- You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ””)’ at line 2
- How to run multiple Async HTTP requests in WordPress?
- WP CLI info showing correct PHP binary but wrong version of PHP
- WordPress admin dashboard missing icons
- How does WP work in conjunction with a web server?
- REST API works in browser and via AJAX but fails via cURL
- Plugin error after installation
- W3 Total Cache Can’t Really Detect Things
- Blog only showing code
- rest_cannot_create_user – Sorry, you are not allowed to create new users. CURL WORDPRESS REST API
- cURL External API request displays content above other content on page
- Restricting access to a file for everyone except logged in users