Search code examples
phplinux.htaccessfastcgiplesk

custom php.ini - nothing seems to work - what do you suggest? FastCGI-php mode - allow_url_fopen OFF


I need to modify the allow_url_fopen value from OFF to ON i have an hosting account on a shared hosting which uses linux and plesk... php is running as fastcgi and safe mode is off. this is the only way i can use this server (except i can switch on php safe mode) according to phpinfo() php.ini file is located here:

Configuration File (php.ini) Path   /etc 
Loaded Configuration File   /etc/php.ini
Scan this dir for additional .ini files     /etc/php.d 

php vesrion : PHP Version 5.3.27

i used ini_get to see the ini tree:

$options = ini_get_all();
print_r($options);

this results:

[allow_url_fopen] => Array ( [global_value] => [local_value] => [access] => 4 ) 

i tried a few things but i am sure it's not enough or i did something wrong... 1. tried to put a php.ini file in the httpdocs folder and didn't work 2. tried custom cgi script - i don't know if the code was correct:

#!/bin/sh
exec /etc/php -c /path/to/myweb/httpdocs/php.ini

and then called from .htacccess file

AddHandler php-cgi .php .htm
Action php-cgi /cgi-bin/php.cgi

3. tried all the php ini_set but nothing works 4. tried in .htaccess

php_value allow_url_fopen On
php_value allow_url_fopen 1

nothing seems to work... any idea?


Solution

  • You obviously cannot use Apache settings file to change PHP settings if you don't run PHP as Apache module.

    The file needs to be called .user.ini, not php.ini (since it's a shared hosting, you cannot edit any server-wide settings file).

    But if we have a look at the list of directives we can see that allow_url_fopen is categorised as PHP_INI_SYSTEM. That means that it's a global server setting, thus you don't have permission to change it. You're out of luck: your hosting account does not offer a feature your current code needs.