Jump to content

Need help with php Errors


glow
Go to solution Solved by mogosselin,

Recommended Posts

Hi I'm in need of help with some errors that the admin page of my cms is spitting out, I'm very new to php but I'm great understanding directions so any help that anyone can provide will be greatly appreciated.

 

These are the errors being displayed:

 

Warning: date() [function.date]: 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 'America/Chicago' for 'CDT/-5.0/DST' instead in /home/mysite/public_html/includes/joomla.php on line 437
 
Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/mysite/public_html/includes/joomla.php:437) in /home/mysite/public_html/includes/joomla.php on line 808
 
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/mysite/public_html/includes/joomla.php:437) in /home/mysite/public_html/includes/joomla.php on line 808
 
I've attached the php file giving the errors, I hope someone can help me.  Thanks in advance.
 
Jude
Edited by glow
Link to comment
Share on other sites

Thank you for your links but this still goes over my head , I wish I understood more of it but I'm not there yet.

 

So in my joomla.php it shows this code in line 103:

-----------------------------------------------------

$now = date( 'Y-m-d H:i', time() );

DEFINE( '_CURRENT_SERVER_TIME', $now );

DEFINE( '_CURRENT_SERVER_TIME_FORMAT', '%Y-%m-%d %H:%M:%S' );

 

and this code in line 436:

 

$now = date( 'Y-m-d H:i:s', time() );

$this->set( 'now', $now );

----------------------------------------------------------

 

so what should go in their place?  thanks you

Link to comment
Share on other sites

As was said - you need to read the manual on how to use 'date_default_timezone_set' and place it at the top of your script.  Ideally it would be in your php.ini (configuration file) but apparently it is not.

 

Then you need to add 'session_start()' at the top of each of your scripts.  Make it a habit.  Of course if you are not using any session vars in that script I guess you could ignore it, but I use it as part of my std. template just to be sure I don't forget it later.

Link to comment
Share on other sites

I tried this but it didn't work:

 

<?php

date_default_timezone_set('America/Los_Angeles');

$script_tz date_default_timezone_get();

if (
strcmp($script_tzini_get('date.timezone'))){
    echo 
'Script timezone differs from ini-set timezone.';
} else {
    echo 
'Script timezone and ini-set timezone match.';
}

?>

Link to comment
Share on other sites

  • Solution

It seems to me like you're fairly new to PHP and you're trying to do something with Joomla?

If you don't understand the error messages and you're 'playing' with Joomla, it's normal that you're lost...

 

Also, if you copy a piece of code and put it there in the hope that it'll work (without understanding how it works), well... the changes are that it won't work ;)

 

All the code that you copied from the timezone thing isn't necessary. You just need something like:

date_default_timezone_set('America/Los_Angeles');

 

You should choose the timezone of your PHP server from the list here: http://php.net/manual/en/timezones.php  Don't just write 'Los_Angeles' if your server isn't in the same timezone, you'll end up with weird results.

 

All the rest of the code in the example is just meant to check if the timezone you set in your code is the same as in your INI settings. When I say "ini settings", it means your PHP configurations. Do you know where your php.ini file is and what it contains?

 

For the other error message, it's similar to the popular 'Headers already sent' error. The 'Header' is something that your server will send to the browser requesting the page. But, the header needs to be first, before any content is sent. And, the header contains cookies (and cookies are used to manage sessions). So, if you send content to the browser (like with a echo "hello", or a blank space, etc.), and then you try to add a cookie, it won't work. The header was already sent... If you want a detailed explanation on how this work, I already wrote a post about it (it's not the exact same error, but it's similar).

 

That being said, why are you using Joomla? Can't you just start with plain PHP and do a simple 'contact form' or any other simple application? It would be, IMO, a better way to start with PHP. :)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.