Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ini_set not working

Tags:

php

Here is the matter:

ini_set('display_errors', '1');
ini_set('safe_mode', '0');
ini_set('allow_url_fopen', '1');
ini_set('allow_url_include', '1');
print_r(ini_get_all());

And I get:

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

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

Why I cannot set that variable within the php ini_set function? The directive is specified as PHP_INI_ALL then it can be defined within the ini_set() function! http://php.net/manual/en/ini.list.php

like image 855
Damiano Barbati Avatar asked Sep 27 '12 09:09

Damiano Barbati


2 Answers

display_errors

may be set at runtime (with ini_set()), but it won't have any affect if the script has fatal errors. This is because the desired runtime action does not get executed.

Use ini_set('display_errors','Off');

safe_mode

This feature has been DEPRECATED as of PHP 5.3.0 and REMOVED as of PHP 5.4.0. This directive belongs to PHP_INI_SYSTEM and Cannot be set via ini_set()

allow_url_include

Use ini_set('allow_url_include', 'On');

allow_url_fopen

This directive belongs to PHP_INI_SYSTEM and Cannot be set via ini_set()

like image 121
Vijay Sarin Avatar answered Nov 15 '22 23:11

Vijay Sarin


These variables cannot be changed within a user script. The access value means:

PHP_INI_SYSTEM    4          Entry can be set in php.ini or httpd.conf  

You can try to set it in .htaccess:

php_value  allow_url_include 1
like image 34
wroniasty Avatar answered Nov 15 '22 22:11

wroniasty