skip to Main Content

Since either when I updated the server to PHP7 or when I enabled AutoSSL for my server I has not been able upload files. My error is as follows

fopen(): https:// wrapper is disabled in the server configuration by allow_url_fopen=0

I have no idea where allow_url_fopen=0 is coming from because in both the global php.ini and the php.ini inside of the sub domain are using stating

allow_url_fopen=On
allow_url_include = On

In phpinfo() I see where my php.ini file is…

Configuration File (php.ini) Path   /opt/cpanel/ea-php70/root/etc
Loaded Configuration File   /opt/cpanel/ea-php70/root/etc/php.ini

When I open this php.ini file I see that allow_file_fopen is “On”

; Whether to allow the treatment of URLs (like http:// or ftp://) as files.
; http://php.net/allow-url-fopen
allow_url_fopen = On

; Whether to allow include/require to open URLs (like http:// or ftp://) as fil$
; http://php.net/allow-url-include
allow_url_include = On

But in the same phpinfo() file I see allow_file_fopen is off

Directive   Local Value Master Value
allow_url_fopen Off Off
allow_url_include   Off Off

From another stack exchange thread I was told to try the following code which turns out it is OFF

if (ini_get("allow_url_fopen") == 'On') {
echo "allow_url_fopen is ON";
} else {
echo "allow_url_fopen is OFF";
}   

Previously I did get this working by using the following code in my controller, but this no longer works for a reason I do not know

ini_set('allow_url_fopen',1);

I am using Laravel 5.2 and Image intervention package to deal with the images that get uploaded. As i said this was all working before PHP7 and AutoSSL

What am I missing?

3

Answers


  1. Chosen as BEST ANSWER

    I was able to find where allow_url_fopen was switched off inside of WHM by editing the "MultiPHP INI Editor" section. From there I selected PHP7. The first option it gave me to to enable allow_url_fopen. This fixed my error.

    I couldn't find where allow_url_fopen was disabled at all through SSH. I guess it is because I didn't understand the upgrade procedure from PHP5 to PHP7 and that I had PHP7 enabled only per account through cPanel though Root apeared to be still using PHP5 for php.ini.


  2. I had the same problem. The configuration of pool was disabled the option:

    A) First I tried to found which file is modifying the setting:

        # cd /etc/php
        # grep -r allow_url_fopen
    
    7.3/fpm/pool.d/worpresspool1.conf:php_admin_flag[allow_url_fopen] = off
    7.3/fpm/php.ini:allow_url_fopen = On
    7.3/cli/php.ini:allow_url_fopen = On
    

    B) Then I edited the file

        # vi /etc/php/7.3/fpm/pool.d/worpresspool1.conf 
    

    and commenting the above line with ;:

        ;php_admin_flag[allow_url_fopen] = off
    

    C) In my case I’ve restarted php-fpm service because I’m using Fast-cgi

        # systemctl restart php7.3-fpm
    
    Login or Signup to reply.
  3. In WHM’s MultiPHPManager, Under PHP-FPM INI Settings,
    Treat URLs as files (allow_url_fopen) – CHECK THIS ON
    Block domain from changing the setting – UNCHECK THIS (Important)
    Then Restart PHP-FPM Service, It works. Meanwhile, make sure it is Enabled at Domain level.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search