Question

I've recently upgraded to a dedicated server; previously I was on a shared server, so I have no experience with the php.ini file. I've opened it and looked through it, searched Google and SO but nothing is clear to me.

Can someone clear up, for me, the way to add/edit lines in an ini file and what, if any, lines can be removed?

More specifically I'd like to edit the time a session is active for, the default date, etc.

UPDATE: I'm running PHP 5.5 on a Linux server.

EDIT: There is some confusion: I'm not asking "how to edit the file". I'm asking "what parts of the file can I remove and where can I update parts of the file".

Was it helpful?

Solution

Ini format is rather simple: entries are key/value pairs, with an equal sign between each side. Comment lines start with a semicolon.

The php.ini is fairly well commented. I'd suggest commenting any lines out, rather than removing them, and restarting the webserver or running a command line app to see that startup goes okay.

Which lines are needed and which values are okay vary depending on your server config and the php programs you intend to run.

The default timezone setting is http://www.php.net/manual/en/datetime.configuration.php#ini.date.timezone

There are a few session related config parameters. I suggest reading How do I expire a PHP session after 30 minutes? for info on session lifetime.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top