Configuring the timezone in PHP

Configuring the timezone in PHP

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.

    • Related Articles

    • Install ScriptCase PHP 7.0 on a XAMPP on Linux

      Xampp Installation Using PHP 7.0 XAMPP It allows you to easily install Apache on your own computer, regardless of your operating system (Linux, Windows, MAC or Solaris). First you have to proceed to download XAMPP PHP ...
    • Install ScriptCase PHP 7.3 on a XAMPP in Linux

      Xampp Installation Using PHP 7.3 XAMPP It allows you to easily install Apache on your own computer, regardless of your operating system (Linux, Windows, MAC or Solaris). First you have to proceed to download XAMPP PHP ...
    • Installing PHP 7.3 - macOS

      This documentation will cover how to install PHP 7.3 and ScriptCase manually on macOS. Performing this type of installation is your responsible for configuring your entire environment as well as database extensions. Listed below are versions of macOS ...
    • Installing PHP 7.3 - Linux

      his documentation will teach all the steps necessary for the installation of the PHP 7.0, Apache 2.4 and the Scriptcase using the manual installation in the Linux environment. Doing this kind of installation you will be responsible for configuring ...
    • Installing Scriptcase with PHP 7.3 on Windows

      This documentation will walk you through the steps necessary to install PHP 7.3, Apache 2.4, and Scriptcase manually. When performing this type of installation, you are responsible for configuring your entire environment as well as database ...