PHPCI
PHPCI copied to clipboard
Started/finished datetimes are wrong
Hello,
When a build is created, I get this time : Jun 29, 2015 10:51 PM (OK) But when it starts, I get this time : Jun 29, 2015 8:52 PM (Wrong, 2 hours offset) Finished date : Jun 29, 2015 9:00 PM (must be 11:00 PM)
OS : Debian 7 with time correctly defined PHP Timezone : "Europe/Paris"
I ran into the same problem and my solution was that phpci can end up using two different php.ini files during the build and run process. Your php.ini file that is set to "Europe/Paris" is being used for the build creation time, but it is looking at a different file when the build is running.
My set-up was: Build created time relied on date.timezone set in: /etc/php5/fpm/php.ini Build Started/Finished relied on date.timezone set in: /etc/php5/cli/php.ini
I believe this is because cli is used for command-line stuff which is how the builds run while fpm is part of the FastCGI Process Monitor, which gets used when you build manually.
I was able to figure it out by adding this line of code to /PHPCI/Builder.php (I chose to place it underneath Line 246 near the end of the Build and before it is removed.
$this->buildLogger->log(php_ini_loaded_file());
Doing a test build will yield the path to the php.ini file it is attempting to use the timezone of.
My recommendation is for a timezone setting to be added in the Settings in the Admin Options of PHPCI.
Hi!
In PHPCI/bootstrap.php change your timezone ;)
date_default_timezone_set('UTC');
More info: https://github.com/Block8/PHPCI/blob/master/bootstrap.php
Hi all,
While adding a timezone setting to the config file will be ideal, another work around is to use the local_vars.php
file to set the right timezone. Ex:
date_default_timezone_set('Europe/Paris');
The advantage of using the local_vars.php
file is that it is ignored in the VCS and automatically included in the app bootstrap.