Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Is it possible to separate my changes to the php.ini into a different file, which overwrite the default settings.

E.g in my project.ini I wanted to overwrite the maxlifetime?

; Overwrite PHP settings required for Project

[Session]
; After this number of seconds, stored data will be seen as 'garbage' and
; cleaned up by the garbage collection process.
; http://php.net/session.gc-maxlifetime
session.gc_maxlifetime = 86400

I have seen some open source websites are packages with the php.ini inside. Is this a better approach?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

You can set php.ini values manually in php with ini_set which overwrites the default values. Put this line at the top of every page (before session_start) or put it in a php file which is included everytime:

ini_set('session.gc_maxlifetime', 86400);

Check this page for more Information: PHP: ini_set - Manual

Additionally you can override ini values by using

php_value session.gc_maxlifetime 86400

in a .htaccess file which is described here: PHP: How to change configuration settings - Manual

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.