Configuring the timezone in PHP
When using a PHP environment, we sometimes encounter the following error:
“ERROR: 2 = date (): it is not safe to rely on the system’s timezone settings.”
This error occurs when PHP is unable to automatically determine the system’s timezone, usually due to the lack of an explicit date.timezone setting in the php.ini file. To fix this, follow the steps below:
1. Find the php.ini file:
The php.ini configuration file may be located within the PHP directory of Scriptcase. In standard installations, you can find it in the following location:
• Windows: C:\Program Files\NetMake\v9\components\php\php.ini
• Linux/Unix: The file may be in a path like Scriptcase/v9-php81/components/php/php.ini (depending on the PHP version used).
2. Edit the php.ini file:
Open the php.ini file in a text editor.
3. Configure the timezone:
In the php.ini file, search for the line that defines the timezone. If the line is commented out (starting with a semicolon), remove the semicolon and set the correct timezone for your region. The line will look like this:
date.timezone = “America/Recife”
Replace “America/Recife” with the correct timezone for your location.
To access the complete list, here.