Warning: file_get_contents(): http:// wrapper is disabled in the server configuration by allow_url_fopen=0
The server forbids PHP from opening URLs with file functions.
Exact message you may see
http:// wrapper is disabled in the server configuration by allow_url_fopen=0URL file-access is disabled in the server configuration
Seen on:
PHP
Meaning
Hosts disable allow_url_fopen for security. file_get_contents('https://…') and fopen on URLs then fail.
Common causes
allow_url_fopen=Offin php.ini- Shared host policy
allow_url_includeconfusion
⚡ Quick fix
- Use cURL instead of
file_get_contentsfor URLs - Enable
allow_url_fopenwhere allowed - Use Guzzle or Symfony HttpClient
Detailed fix by platform
PHP
$ch = curl_init($url); curl_setopt_array($ch, [CURLOPT_RETURNTRANSFER => true, CURLOPT_TIMEOUT => 10]); $body = curl_exec($ch);
How to diagnose
- ini — php -i | grep allow_url?
- Host — Shared hosting policy?
- Alternative — cURL available?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
Most viewed in PHP
Other ways to find it
Where this error sits
Origin: Application & API. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Did this fix work for you?
Report a correction or suggest an improvement
Last updated 2 Dec 2026