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
On the above server, you can see that the PHP configuration file is in location “/usr/local/lib/php.ini”
Edit the php.ini file to enable allow_url_fopen.
root@server [~]# vi /usr/local/lib/php.ini
allow_url_fopen = On
Change the line “allow_url_fopen = Off” to “allow_url_fopen = On”
Save the php.ini file after changing allow_url_fopen to On.
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
On some systems there’s a file
/etc/php.d/security.ini
or/etc/php/8.1/fpm/conf.d/99-security.conf
in whichallow_url_fopen
is turned of. If present it overrides the settings inphp.ini
system wide.Unfortunately this file isn’t listed by
php_ini_scanned_files()
.