In order to use file_get_contents() with a URL, you need to enable allow_url_fopen. I did this for a domain in that domain's cPanel MultiPHP INI Editor.
However, this only seems to apply to the domain's main public_html folder. Inside subfodlers, e.g. https://www.example.com/subfolder/test.php, the changes to the local MultiPHP INI Editor do not seem to apply.
If I do phpinfo() from e.g. https://www.example.com/test.php, then the Loaded Configuration File shows up as $HOME/public_html/php.ini. But from https://www.example.com/subfolder/test.php, then phpinfo() says that the Loaded Configuration File is /opt/cpanel/ea-php81/root/etc/php.ini.
I used WHM to modify the root allow_url_fopen settings.
Also, if I place a php.ini in the subfolder with "allow_url_fopen = On", then that also works. As the subfolder's php.ini will be used.
However, I was wondering if there was any to get the changes I make in cPanel to MultiPHP INI Editor, to automatically apply to all subfolders on the domain. Is this possible? Or is the only way to edit the settings of the subfolders, using a subfolder php.ini, or modifying the root php.ini?
If you need to adjust a particular feature in PHP, the usual way to do so is by modifying the global ini file for the version of PHP that requires the change. You can use WHM's MultiPHP INI Editor to make these modifications for each version of PHP individually. However, it's worth noting that making changes to this setting will affect all accounts that use that particular version of PHP. So, if you have several sites that need this feature enabled and others where it should be disabled, you can enable it for a specific PHP version instead. This way, only accounts that require this feature can use that particular PHP version for their sites.