Set Timezone in PHP

Some applications in PHP, can give a problem if you do not find the variable timezone set in php.ini, because they do not consult local timezone of the server.

To solve this, we set the timezone in PHP configuration file: php.ini.

Look for your php.ini file:

# Find / -name php.ini

Generally, it is located in /etc/php.ini.

Edit and change the timezone setting:

Find the date.timezone line and leave it below:

From:; date.timezone =
For:

date.timezone = America / Sao_Paulo

If your timezone is another, just change the America / Sao_Paulo parameter to your timezone.

The timezones list can be found here:

 

That’s All!.

You may also like

1 comentário

Deixe um comentário

O seu endereço de e-mail não será publicado. Campos obrigatórios são marcados com *