Banner

Sponsor

Login


Welcome Back!
Guest
Guest

Register

Lost your password?

49 users online



I Pronounce This Forum Dead

I Pronounce This Forum Dead

Currently viewing this thread: 1 (0 members and 1 guests)


Page 6 out of 6
AbsoluteCross

AbsoluteCross

Neverside Admin/Owner
Status: Offline!

Hey guys, another question for the PHP gurus. A while back Jeremie told me that the (likely) only thing keeping NS from running on PHP 5 was to do with the way date/timestamp was generated. I'm hoping to fix these if it ends up being a simple/easy fix, so I can get rid of PHP 4 on the server (tried setting 4 and 5 up concurrently with fastcgi, but no luck). I've got a local copy of NS running on PHP 5 now, and set error_reporting(E_STRICT); --- it was set to E_ALL by default.

Instead of crashing PHP like it did before, it gave a helpful error message:

Quote:

File: /htdocs/sites/Nside/areas/portal/index.php
Line: 66
Errno: 2048 (UNKNOWN)
Error: date() [<a href='function.date'>function.date</a>]: It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable 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 'America/Los_Angeles' for 'PDT/-7.0/DST' instead

Here are a few relevant bits of code from NS... this is from config.php:

PHP:

<?php

    
// Time settings
    
'timezone'        => -8,
    
'time_format'        => 'h:i A',
    
'date_format'        => 'F jS, Y',
    
'date_format_short'    => 'M jS, Y',

?>

And this is line 66 from the Portal section's index.php, as referenced by the error message (this is only found in a few other files, a few times just referencing $today or mktime, and a few times in a bit different context, but the same mktime function):

PHP:

<?php
$today 
mktime(000date('n'), date('j'), date('Y'));
?>

And lastly, one other file that came up in a search for $today was templates/ns/functions.php and included this code:

PHP:

<?php

************************************************
 * 
Formats a timestamp
 
* ---
 * @
param  INTEGER The timestamp to format
 
* @param  BOOLEAN : If the format to should be short or not
 
* @return STRING  The formatted timestamp
 
***********************************************/
function 
format_date($time$short FALSE)
{
    global 
$cfg$user;
    static 
$today;

    
// First call, get today's timestamp
    
if($today === NULL)
    {
        
$today mktime(000date('n'), date('j'), date('Y')) + ($user['timezone'] - $cfg['timezone']) * 3600;
    }

    
// Adjust the time according to the user's timezone
    
$time += ($user['timezone'] - $cfg['timezone']) * 3600;

    
// Today
    
if($time >= $today && $time <= $today 86400)
    {
        return 
'Today, <span class="time">' date($cfg['time_format'], $time) . '</span>';
    }

    
// Yesterday
    
if($time >= $today 86400 && $time <= $today)
    {
        return 
'Yesterday, <span class="time">' date($cfg['time_format'], $time) . '</span>';
    }

    
// Tomorrow
    
if($time >= $today 86400 && $time <= $today 172800)
    {
        return 
'Tomorrow, <span class="time">' date($cfg['time_format'], $time) . '</span>';
    }

    
// Other dates
    
return date(($short $cfg['date_format_short'] : $cfg['date_format']) . ' <\sp\a\n c\l\a\s\s="\t\i\me">' $cfg['time_format'] . '</\sp\a\n>'$time);
}

?>

As I'm still a newbie with PHP, I don't know what to do, but perhaps the solution is simple to you guys. If so I've love to get your suggestions. If some additional code or files from NS would help, please let me know and I will provide it.

Thanks!

___________________

-- Dave
Neverside Admin
http://www.absolutecross.com/images/buttons/ac_metal.gif
absolutecross.com

Last edited by AbsoluteCross, June 13th, 2008 01:04 AM (Edited 2 times)

AbsoluteCross

AbsoluteCross

Neverside Admin/Owner
Status: Offline!

Just figured out a way that "may" bypass the need to fix NS's code... I added the following line to the php.ini file, telling PHP (I believe) to use the pacific standard timezone:

date.timezone = "America/Los_Angeles"

After saving and restarting Apache, the errors are gone and NS is running fine (well so far, I haven't tested thoroughly) under PHP 5.

Guess that's good enough if it works - no need to spend time fixing NS code. However if someone does want to fix it properly, feel free, since NeverAPI may eventually be released as open source so might as well have it right. Wish I had understood about E_STRICT a long time ago haha... would have saved me days of wasted time :P

In the next few days (whenever I get time set aside for it) I will be backing up the server, and installing CentOS 5 with all the latest software versions. So don't worry if the site is down for a day or so.

I still have no clue about why the Studio doesn't work though - while I was doing this other testing I had another look at it for a half hour or so, and can't figure it out. If anyone cares to give that a shot (so the Studio will work for now until the new site) then please let me know.

___________________

-- Dave
Neverside Admin
http://www.absolutecross.com/images/buttons/ac_metal.gif
absolutecross.com

blackdahlia

blackdahlia

Serra Is King
Status: Offline!
Originally posted by Adobe4Dummies:

lol.

Now there's a name I haven't seen in years!! Grin

___________________

www.myspace.com/blackbeltpride

Page 6 out of 6
Quick Jump:

Main Navigation


Site & Graphic Design by Aeon Tan
Developed by Jeremie Pelletier & Scott Roach


NeverAPI generated this page in 0.0095 seconds.