I need to set the php setting "allow_url_fopen" to "On".

Avatar
  • updated
  • Answered

I intend to install Drupal using Composer and the php setting "allow_url_fopen" needs to be set to "On". The system default seems to be set to "Off". I have a local php.ini file, that was created through cPanel, in my home directory with the "allow_url_fopen" set to "On". However Composer won't run and complains about the incorrect setting. If from my directory I execute the command ">php -i | grep allow_url_fopen" I see the output as "allow_url_fopen => Off => Off".

Why is then when I run php from my home directory the settings in the local php.ini file aren't being respected?

Avatar
IMH Support Agent 1
  • Answered

Hello Charles,

Thank you for cotacting us about changing your PHP settings. A phpinfo page can help you verify that the changes are being reflected. Also, you may have to make the rules in the php.ini file recursive, this means the changes will affect any child files/folders.

Also, check that there aren't additional php.ini files in a higher level folder or other location.

Thank you,

John-Paul

Avatar
Charles

Hi John-Paul,

Thanks for the reply. I wasn't able to get the php to abide by the local php.ini file however I was able to circumvent the issue buy using "php -d allow_url_fopen=on" before the composer command. Such as:

~>php -d allow_url_fopen=on /home/<username>/bin/composer install

So problem solved for now. Thanks.

Avatar
IMH Support Agent 2
Quote from Charles

Hi John-Paul,

Thanks for the reply. I wasn't able to get the php to abide by the local php.ini file however I was able to circumvent the issue buy using "php -d allow_url_fopen=on" before the composer command. Such as:

~>php -d allow_url_fopen=on /home/<username>/bin/composer install

So problem solved for now. Thanks.

Hi Charles,

Thanks for updating us on the solution you have found. Just as an FYI, depending on your account type, a change to the server-wide php.ini file wouldn't be possible without root level access.  If you're on a shared server (business-level account), then you wouldn't be able to make a change to that php.ini file.  However, on a VPS or Dedicated server, you can make changes with root-level access.

We do appreciate you letting us know how you made it work!  These answers are public domain and may help someone with the same issue!  Thanks again!

Kindest regards,

Arnel C.