skip to Main Content

I’m trying to run a php website with nginx using php8.1 and php8.1-fpm, in a Ubuntu 20.04 vps.

phpinfo reports that the config file in use is: /etc/php/8.1/fpm/php.ini

It also reports that allow_url_fopen is Off (both Local Value and Master Value).
Examining /etc/php/8.1/fpm/php.ini shows:

allow_url_fopen = On

I suppose that’s the default setting. But I need this value to reflect in phpinfo and I can’t get that to work.

I’ve tried changing the value, restarting nginx and fpm, changing it back and restarting again, but nothing works. Feels like phpinfo is getting its values elsewhere. I’ve checked all files in /etc/php/8.1/fpm/conf.d (the config folder reported by phpinfo) and there is no allow_url_fopen in any of those.

How do I get allow_url_fopen to be On?

2

Answers


    1. Type “php –ini” command to find the location of the PHP configuration file.
      enter image description here

    On the above server, you can see that the PHP configuration file is in location “/usr/local/lib/php.ini”

    1. Edit the php.ini file to enable allow_url_fopen.

      root@server [~]# vi /usr/local/lib/php.ini
      allow_url_fopen = On

    2. Change the line “allow_url_fopen = Off” to “allow_url_fopen = On”

    3. Save the php.ini file after changing allow_url_fopen to On.

    4. Restart the apache service after enabling allow_url_fopen.

    Now, allow_url_fopen is enabled globally for all domains on your Server. allow_url_include = On

    Login or Signup to reply.
  1. On some systems there’s a file /etc/php.d/security.ini or /etc/php/8.1/fpm/conf.d/99-security.conf in which allow_url_fopen is turned of. If present it overrides the settings in php.ini system wide.

    Unfortunately this file isn’t listed by php_ini_scanned_files().

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