Welcome Guest, Not a member yet? Register   Sign In
codeigniter num_rows throws timezone error when corrected then page shows 500 internal server error
#1

[eluser]jayapalchandran[/eluser]
I am using codeigniter 2 for a module in my site. this is the first run on production.

num_rows() throws the following error

Quote:A PHP Error was encountered

Severity: Warning

Message: Home::index() [home.index]: It is not safe to rely on the system's timezone settings. You are required to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Asia/Calcutta' for 'IST/5.0/no DST' instead

Filename: controllers/home.php

Line Number: 18

in line no 18 i have echo $catgory->num_rows();

then i updated the code as follows

Code:
function __construct()
{
    date_default_timezone_set('UTC');
    parent::__construct();
}

When reloaded the page i get

HTTP Error 500 (Internal Server Error): An unexpected condition was encountered while the server was attempting to fulfill the request.

What could be the problem?

Is there any possibility to hide this particular error?

Is it anything to do with the server side settings?
#2

[eluser]Aken[/eluser]
Try verifying the timezone setting in your php.ini file instead of setting it in your script. Not really sure why calling a function would cause a 500 server error, so try something simple first, instead.
#3

[eluser]Bart v B[/eluser]
The internal server error sound like a mistake in your .htaccess file.

To put a datetime zone in your script it's better to put it in your index.php
Just at the start on row 2. ;-)
For example i did that for a dutch site:
index.php
Code:
<?php
date_default_timezone_set('Europe/Amsterdam');
setlocale(LC_TIME, "nl_NL.UTF8");
/*
*---------------------------------------------------------------
* APPLICATION ENVIRONMENT
*---------------------------------------------------------------
*




Theme © iAndrew 2016 - Forum software by © MyBB