开发者

how to over ride php.ini

What are the ways available to over ride php.ini setting,

i want to over ride the max-life-time,

currently max life time is 30 min, i want to change this to 10 hrs,

Tell me the ways.

  1. i tried with ini_set in the php config page,
  2. i tried with some log ( with some snippets) ,
  3. finally tried with .htaccess ,

But all of my above methods are failed,

Tell me some other ways to over ride the php.ini setting( max life time )

For your inform开发者_StackOverflow中文版ation, i dont have the permission to access the php.ini file,


Which configuration directive are you referring to exactly?

The closest thing I can find is session.gc_maxlifetime which is settable via ini_set(), eg

ini_set('session.gc_maxlifetime', 3600);

You can change configuration settings based on the change mode of the directive and how PHP is run.

In general, any directive that is PHP_INI_USER or PHP_INI_ALL can be changed using ini_set()

If PHP is run as an Apache module, you can use the php_value and php_flag directives in an Apache configuration file (httpd.conf, .htaccess, etc)

If PHP is run via CGI (quite popular on shared hosts), you may be able to include your own php.ini file. There are certain subtleties to this method which I've blogged about extensively here - http://blog.philipbrown.id.au/2009/08/php-suexec-and-custom-php-ini-files/


You could try putting the following into you .htaccess file

php_value session.gc_maxlifetime 3600

See: http://php.net/manual/en/configuration.changes.php


If ini_set isn't working, it's likely disabled in the server's php.ini file. If this is the case, you likely can't override the setting, as preventing people from overriding settings is what disabling those functions is specifically for. Even if you don't have access to change the php.ini file, do you have access to read it? If so, look for a disable_functions setting. If you don't have access to php.ini, try and see what this gives you:

echo ini_get('disable_functions');

Of course, that might have been disabled, too...


There is no setting max-life-time, setting names do not contain dashes. Also max_life_time doesn't exist.

A list of available settings is available on the php website. Which setting are you trying to set/change?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜