diff --git a/admin/config.php b/admin/config.php
index bd7561acc4e..7ce468884d9 100644
--- a/admin/config.php
+++ b/admin/config.php
@@ -97,12 +97,14 @@
$httpsurl = str_replace('http://', 'https://', $CFG->wwwroot);
if ($httpsurl != $CFG->wwwroot) {
- if ((($fh = @fopen($httpsurl, 'r')) == false) and ($config->loginhttps == 0)) {
- echo ''."\n";
+ if (ini_get('allow_url_fopen')) {
+ if ((($fh = @fopen($httpsurl, 'r')) == false) and ($config->loginhttps == 0)) {
+ echo ''."\n";
+ }
}
}