Time Tracker install in HOSTING ENVIRONMENTS

Discussion forum about Anuko Time Tracker
peter
Posts: 77
Joined: Sat May 29, 2010 2:06 pm

Re: Time Tracker install in HOSTING ENVIRONMENTS

Post by peter » Fri Nov 13, 2015 2:52 am

Looks like you are not using the latest Time Tracker code, as line 347 does not exist in the most recent /WEB-INF/lib/common.lib.php

But basically the problem looks like your server logs errors to the output before a redirect to login.php page occurs. In this case redirect is not happening and you end up with a blank page in browser.

You'll need to identify what this error is and fix it (something must be happening before "PHP Warning: Cannot modify header information - headers already sent").

tlynnec
Posts: 18
Joined: Fri Mar 04, 2016 5:53 pm

Re: Time Tracker install in HOSTING ENVIRONMENTS

Post by tlynnec » Fri Mar 04, 2016 6:34 pm

I've installed timetracker on my host (dreamhost) according to the directions. However, when I go to my site I get a blank page and the url looks like this: https://time.mysite.com/time.php?date=2016-03-04

I had to create the mysql db from my host's site, but I can see in phpmyadmin that the dbinstall function added all the tables, so I believe the db side is working correctly.

The only errors logged are as follows:
[Fri Mar 04 10:07:20 2016] [error] [client 12.252.41.166] File does not exist: /home/anuko/time.mysite.com/plugin
[Fri Mar 04 10:07:20 2016] [error] [client 12.252.41.166] File does not exist: /home/anuko/time.mysite.com/missing.html
I downloaded the most recent stable release (version 1.9.12.3383), extracted the .zip files, and put them on the webhost. It does not appear the plugin or missing.html exist in the original files, so I have no idea why its referring to these items in the error log.

I am stumped. For reference, I'm on php 5.6 FastCGI. other options available include 5.6 CGI, 7.0 CGI, and 7.0 FastCGI.
templates_c is set to 777
Last edited by tlynnec on Tue Mar 08, 2016 5:45 pm, edited 1 time in total.

Nik
Posts: 461
Joined: Wed May 26, 2010 5:55 pm

Re: Time Tracker install in HOSTING ENVIRONMENTS

Post by Nik » Fri Mar 04, 2016 7:36 pm

tlynnec wrote:I've installed timetracker on my host (dreamhost) according to the directions. However, when I go to my site I get a blank page and the url looks like this: https://time.waterutilitymanagementserv ... 2016-03-04

I had to create the mysql db from my host's site, but I can see in phpmyadmin that the dbinstall function added all the tables, so I believe the db side is working correctly.

The only errors logged are as follows:
[Fri Mar 04 10:07:20 2016] [error] [client 12.252.41.166] File does not exist: /home/anuko/time.waterutilitymanagementservices.com/plugin
[Fri Mar 04 10:07:20 2016] [error] [client 12.252.41.166] File does not exist: /home/anuko/time.waterutilitymanagementservices.com/missing.html
I downloaded the most recent stable release (version 1.9.12.3383), extracted the .zip files, and put them on the webhost. It does not appear the plugin or missing.html exist in the original files, so I have no idea why its referring to these items in the error log.

I am stumped. For reference, I'm on php 5.6 FastCGI. other options available include 5.6 CGI, 7.0 CGI, and 7.0 FastCGI.
templates_c is set to 777
Your log error probably have nothing to do with the problem - is this your IP 12.252.41.166 or someone is probing your web server?

Access from here works fine: https://time.waterutilitymanagementserv ... /login.php - the page is displayed, but then is blank after attempting to login. Check your error log again. Hopefully there is more there to see.

If you open a support incident and provide access to your server Anuko can troubleshoot and fix the problem.

tlynnec
Posts: 18
Joined: Fri Mar 04, 2016 5:53 pm

Re: Time Tracker install in HOSTING ENVIRONMENTS

Post by tlynnec » Fri Mar 04, 2016 7:48 pm

the 12 is my ip, so no worrries there. only new errors logged are
[Fri Mar 04 11:21:44 2016] [error] [client 46.46.87.78] File does not exist: /home/anuko/time.mysite.com/anything
[Fri Mar 04 11:21:44 2016] [error] [client 46.46.87.78] File does not exist: /home/anuko/time.mysite.com/missing.html
I'm guessing that was you?
Last edited by tlynnec on Tue Mar 08, 2016 5:52 pm, edited 1 time in total.

tlynnec
Posts: 18
Joined: Fri Mar 04, 2016 5:53 pm

Re: Time Tracker install in HOSTING ENVIRONMENTS

Post by tlynnec » Fri Mar 04, 2016 8:08 pm

another thought: I had to pre-create the mysql db through my host and, since timetracker was not available as a db name, I had to give it a different name. That name is correctly inserted in the config file and the tables exist in it. However, does Timetracker require that the db be named timetracker? if so, is there somewhere where i need to change all the default references so that it will refer to the correct db name?

wrc
Posts: 269
Joined: Tue May 25, 2010 8:30 pm

Re: Time Tracker install in HOSTING ENVIRONMENTS

Post by wrc » Fri Mar 04, 2016 8:25 pm

tlynnec wrote:another thought: I had to pre-create the mysql db through my host and, since timetracker was not available as a db name, I had to give it a different name. That name is correctly inserted in the config file and the tables exist in it. However, does Timetracker require that the db be named timetracker? if so, is there somewhere where i need to change all the default references so that it will refer to the correct db name?
Database name can be anything you like. But you have to grant permissions to use it to the account specified in config.php.

tlynnec
Posts: 18
Joined: Fri Mar 04, 2016 5:53 pm

Re: Time Tracker install in HOSTING ENVIRONMENTS

Post by tlynnec » Fri Mar 04, 2016 8:36 pm

ok, well then that *shouldn't* be my issue. As far as I can tell, the correct permissions are set in config.php: dbname changed to my db's correct name in the define('DSN'... line and the correct passwords etc are there. I'm also not getting any "cannot connect to database" type errors. I don't see anywhere else that it needs to be changed?

I saw another post in the forum (unanswered) about someone who had the same issue when switching the php 5.6, which i'm on. are there any know issues with running on 5.6? should i try switching to php 7?

Nik
Posts: 461
Joined: Wed May 26, 2010 5:55 pm

Re: Time Tracker install in HOSTING ENVIRONMENTS

Post by Nik » Sat Mar 05, 2016 2:50 pm

tlynnec wrote:ok, well then that *shouldn't* be my issue. As far as I can tell, the correct permissions are set in config.php: dbname changed to my db's correct name in the define('DSN'... line and the correct passwords etc are there. I'm also not getting any "cannot connect to database" type errors. I don't see anywhere else that it needs to be changed?

I saw another post in the forum (unanswered) about someone who had the same issue when switching the php 5.6, which i'm on. are there any know issues with running on 5.6? should i try switching to php 7?
It's difficult to guess what may be going on with your system without access to it.

What we see from here is that login.php page displays properly, but a redirect after login is not happening, why? May be because some file leaks a white space to output before a redirect? Are you sure all source files are intact?

Now the second issue, which may be a separate one, is that time.php displays blank as well.

Without access I can only suggest debugging locally by inserting, for example, a die("some message here"); statement in different locations of source files and observe the output if "some message here" shows up properly. For example, you can start hacking around with time.php, going from the beginning. If it does not work even in the beginning of the file, perhaps the problem is in one of the included files, such as initialize.php.

The point is that going in this way you can hopefully determine where the problem occurs exactly, which will give you more info about it.

And check if you have all files intact from the recent distribution.

With regards to PHP 5.6 - we are not aware of any issues at the moment.

It may be faster to address the issue via a support incident.

tlynnec
Posts: 18
Joined: Fri Mar 04, 2016 5:53 pm

Re: Time Tracker install in HOSTING ENVIRONMENTS

Post by tlynnec » Tue Mar 08, 2016 5:44 pm

Issue solved. Excellent paid support. Thanks.

admin
Posts: 553
Joined: Fri Oct 08, 2004 9:46 pm
Location: Vancouver, Canada
Contact:

Re: Time Tracker install in HOSTING ENVIRONMENTS

Post by admin » Wed Mar 09, 2016 3:02 pm

tlynnec wrote:Issue solved. Excellent paid support. Thanks.
Just to clarify for others who may be seeing the same issue. Redirect was not happening because of trailing white space after the terminating PHP tag in a customized WEB-INF/config.php. The issue was fixed be removing the white space.

Also, we have removed the terminating PHP tag from WEB-INF/config.php.dist completely in Time Tracker 1.9.13.3397 to hopefully avoid this problem in future installations.

tlynnec
Posts: 18
Joined: Fri Mar 04, 2016 5:53 pm

Re: Time Tracker install in HOSTING ENVIRONMENTS

Post by tlynnec » Sat Mar 12, 2016 12:07 am

admin wrote:Just to clarify for others who may be seeing the same issue. Redirect was not happening because of trailing white space after the terminating PHP tag in a customized WEB-INF/config.php. The issue was fixed be removing the white space.

Also, we have removed the terminating PHP tag from WEB-INF/config.php.dist completely in Time Tracker 1.9.13.3397 to hopefully avoid this problem in future installations.
A little more info that I just figured out: When editing the config file in notepad.exe, the encoding gets changed from UTF-8 to UTF-8-BOM, which results in a blank space at the end of the file, which breaks it. Opened the file in notepad++ instead and set the encoding back to UTF-8, and presto it works.

joelga
Posts: 4
Joined: Wed Jul 13, 2016 5:36 pm

Re: Time Tracker install in HOSTING ENVIRONMENTS

Post by joelga » Wed Jul 13, 2016 5:42 pm

Hi all,

I've installed Time Tracker in a hosted environment with our host, Bluehost, and I *think* I've done so correctly, but I'm getting an error of:

"MDB2 Error: unknown error"

I am able to get to the screen to create the database, and then I get the error. I can even get to the login page:

http://www.admin.enduranceevolution.com/timetracker/

But upon trying to login I get the MDB2 Error: unknown error message.

Any thoughts?

peter
Posts: 77
Joined: Sat May 29, 2010 2:06 pm

Re: Time Tracker install in HOSTING ENVIRONMENTS

Post by peter » Fri Jul 15, 2016 1:47 am

joelga wrote:I've installed Time Tracker in a hosted environment with our host, Bluehost, and I *think* I've done so correctly, but I'm getting an error of:

"MDB2 Error: unknown error"

I am able to get to the screen to create the database, and then I get the error. I can even get to the login page:

http://www.admin.enduranceevolution.com/timetracker/
Did you create a database using dbinstall.php (top step on the page). Was it successful? Does your db structure look like in mysql.sql file?

Do you see any additional details in your web server error log?

joelga
Posts: 4
Joined: Wed Jul 13, 2016 5:36 pm

Re: Time Tracker install in HOSTING ENVIRONMENTS

Post by joelga » Fri Jul 15, 2016 5:43 pm

Hi peter,

Yep, I did create the DB using the dbinstall.php file by going to the following address:

http://www.admin.enduranceevolution.com ... nstall.php (I've since renamed the dbinstall.php file)

I don't think the db creation was successful, because after starting the db install, that's when I first got that error message. I'm not a database guy and I really don't know much about SQL, so I'm not sure where/how to look into the mysql file :/ I'm not sure where to find the server error logs, either.

peter
Posts: 77
Joined: Sat May 29, 2010 2:06 pm

Re: Time Tracker install in HOSTING ENVIRONMENTS

Post by peter » Sun Jul 17, 2016 9:17 pm

You can save the content below in a file named environment_check.php and put it the installation directory. The access it in browser. If will troubleshoot for basic configuration errors.

Code: Select all

<?php
// +----------------------------------------------------------------------+
// | Anuko Time Tracker
// +----------------------------------------------------------------------+
// | Copyright (c) Anuko International Ltd. (https://www.anuko.com)
// +----------------------------------------------------------------------+
// | LIBERAL FREEWARE LICENSE: This source code document may be used
// | by anyone for any purpose, and freely redistributed alone or in
// | combination with other software, provided that the license is obeyed.
// |
// | There are only two ways to violate the license:
// |
// | 1. To redistribute this code in source form, with the copyright
// |    notice or license removed or altered. (Distributing in compiled
// |    forms without embedded copyright notices is permitted).
// |
// | 2. To redistribute modified versions of this code in *any* form
// |    that bears insufficient indications that the modifications are
// |    not the work of the original author(s).
// |
// | This license applies to this document only, not any other software
// | that it may be combined with.
// |
// +----------------------------------------------------------------------+
// | Contributors:
// | https://www.anuko.com/time_tracker/credits.htm
// +----------------------------------------------------------------------+

require_once('WEB-INF/config.php');
require_once('WEB-INF/lib/common.lib.php');
require_once('initialize.php');

echo('<h2>Environment check</h2>');

// Require the configuration file with application settings.
if (file_exists(APP_DIR."/WEB-INF/config.php")) {
  echo('WEB-INF/config.php file exists.<br>');    
} else {
  echo('<font color="red">Error: WEB-INF/config.php file does not exist.</font><br>');
}

// Check whether DSN is defined.
if (defined('DSN')) {
  echo('DSN is defined as '.DSN.'<br>');   
} else {
  echo('<font color="red">Error: DSN value is not defined. Check your config.php file.</font><br>');    
}

// Depending on DSN, require either mysqli or mysql extensions.
if (strrpos(DSN, 'mysqli://', -strlen(DSN)) !== FALSE) {
  if (extension_loaded('mysqli')) {
    echo('mysqli PHP extension is loaded.<br>');   
  } else {
    echo('<font color="red">Error: mysqli PHP extension is required but is not loaded.</font><br>'); 
  }
}
if (strrpos(DSN, 'mysql://', -strlen(DSN)) !== FALSE) {
  if (extension_loaded('mysql')) {
    echo('mysql PHP extension is loaded.<br>');   
  } else {
    echo('<font color="red">Error: mysql PHP extension is required but is not loaded.</font><br>'); 
  }
}

// Check mbstring extension.
if (extension_loaded('mbstring')) {
  echo('mbstring PHP extension is loaded.<br>');   
} else {
  echo('<font color="red">Error: mbstring PHP extension is not loaded.</font><br>'); 
}

// Check gd extension.
if (extension_loaded('gd')) {
  echo('gd PHP extension is loaded.<br>');   
} else {
  echo('<font color="red">Error: gd PHP extension is not loaded. It is required for charts plugin.</font><br>'); 
}

// Check ldap extension.
if (AUTH_MODULE == 'ldap') {
  if (extension_loaded('ldap_')) {
    echo('ldap PHP extension is loaded.<br>');   
  } else {
    echo('<font color="red">Error: ldap PHP extension is not loaded. It is required for LDAP authentication.</font><br>'); 
  }
}

// Check database access.
require_once('MDB2.php');
$conn = MDB2::connect(DSN);
if (!is_a($conn, 'MDB2_Error')) {
  echo('Connection to database successful.<br>'); 
} else {
  die('<font color="red">Error: connection to database failed. '.$conn->getMessage().'</font><br>');   
}

$conn->setOption('debug', true);
$conn->setFetchMode(MDB2_FETCHMODE_ASSOC);

$sql = "show tables";
$res = $conn->query($sql);
if (is_a($res, 'MDB2_Error')) {
  die('<font color="red">Error: show tables returned an error. '.$res->getMessage().'</font><br>');   
}
$tblCnt = 0;
while ($val = $res->fetchRow()) {
 $tblCnt++;
}
if ($tblCnt > 0) {
  echo("There are $tblCnt tables in database.<br>");
} else {
  echo('<font color="red">Error: there are no tables in database. Use dbinstall.php.</font><br>');   
}
$conn->disconnect();
Regular output is something like this:

Code: Select all

Environment check
WEB-INF/config.php file exists.
DSN is defined as mysqli://user:secret@localhost/timetracker?charset=utf8
mysqli PHP extension is loaded.
mbstring PHP extension is loaded.
gd PHP extension is loaded.
Connection to database successful.
There are 19 tables in database.
Let us know what you see. I am getting "MDB2 Error: unknown error" when I misspell server name in DSN. For example, localhost2 instead of localhost will produce this output for me:

Code: Select all

Environment check
WEB-INF/config.php file exists.
DSN is defined as mysqli://user:secret@localhost2/timetracker?charset=utf8
mysqli PHP extension is loaded.
mbstring PHP extension is loaded.
gd PHP extension is loaded.
Error: connection to database failed. MDB2 Error: unknown error
Hope it helps.

Post Reply