skip to Main Content

I have cPanel and I want enable allow_url_fopen on my host.
When I use this code

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

Show me

allow_url_fopen is OFF

3

Answers


  1. If your PHP version is under 5.4 you can use the following line of code to set allow_url_fopen to true.

    ini_set('allow_url_fopen', '1');
    
    Login or Signup to reply.
  2. You should not enable fopen manually but instead use these commands on the terminal to install a package

    Find the path of composer by running this command first:

    $ which composer
    /usr/local/bin/composer
    

    Install Package after that by using this path:

    $ php -d allow_url_fopen=on /usr/local/bin/composer install package_name
    

    OR

    php -d allow_url_fopen=on `which composer` install package_name
    
    Login or Signup to reply.
  3. How to enable or disable allow_url_fopen in cPanel
    There are certain scenarios when you may be asked to make changes to your PHP configuration. Specifically, you may be directed to edit a file on your server called php.ini, and to enable or disable allow_url_fopen.

    While do not allow direct changes to PHP.ini on our servers. However, PHP configuration changes can be made from cPanel by following these steps:

    1. Log into cPanel.

    2. Look for the SOFTWARE section and click on Select PHP version: cPanel > Software > Select PHP Version
      enter image description here

    3. In the new window click on the Switch To PHP Options link : Select PHP Version > Switch to PHP Options.
      enter image description here

    4. Here you can locate the allow_url_fopen and tick on the box next to it to enable it or un-tick the box to disable it.

    5. Once you’ll do any change, please do a left-hand side click anywhere outside the dropdown or text input box. If the change was successful, you will see a green box with a message which will confirm that the change has been applied.

    That’s all! Now you know how to enable or disable allow_url_fopen in cPanel.

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