It’s very common to have the PHP directive allow_url_fopen not working in a cPanel server. This is a security directive, which is disabled by default. It’s very easy to have it enabled, as cPanel allows us to fully customize php.ini. We will show with images and examples on how to allow URL fopen in cPanel.
This is normally useful for shared hosting servers with cPanel. This can also be applied to VPS or Dedicated Servers with WHM. MultiPHP INI Editor is a tool that allows us to edit the server configuration, and customize the php.ini file. This directive is similar to file_get_contents: it can also be allowed via MultiPHP INI Editor.
Firstly, you have to access your cPanel control panel. Then, find the option MultiPHP INI Editor.
Now, you have to click in the tab Editor Mode.
Then, select the domain where you wish to enable allow_url_fopen in cPanel.
After that, you will be redirected to the php.ini file. Now you need to find the line containing allow_url_fopen. In our sample, this line is located at #509. This can vary from server to server.
You need to set this line, just like:
allow_url_fopen = On
Afterwards, click Save.
Finally, you will see this Success message.
Conclusion
Any php.ini file directive can be customized per domain in cPanel. It’s very easy to allow URL fopen in cPanel using these quick steps. Other PHP directives can also be changed, just like file_get_contents.