News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Fatal error - "It is not safe to rely on the system's timezone settings." ?!

Started by Samker, November 10, 2015, 03:12:36 AM

Previous topic - Next topic

Samker

Hi All,

Can somebody help me with this error which suddenly appeared: http://scforum.info

Quote
"Strict Standards: main() [function.main]: 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/Chicago' for 'CST/-6.0/no DST' instead in /home1/scforum/public_html/index.php on line 47

Notice: Undefined variable: boarddir in /home1/scforum/public_html/index.php on line 47

Strict Standards: main() [function.main]: 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/Chicago' for 'CST/-6.0/no DST' instead in /home1/scforum/public_html/index.php on line 51

Notice: Undefined variable: sourcedir in /home1/scforum/public_html/index.php on line 51

Strict Standards: require_once() [function.require-once]: 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/Chicago' for 'CST/-6.0/no DST' instead in /home1/scforum/public_html/index.php on line 51

Warning: require_once(/QueryString.php) [function.require-once]: failed to open stream: No such file or directory in /home1/scforum/public_html/index.php on line 51

Strict Standards: require_once() [function.require-once]: 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/Chicago' for 'CST/-6.0/no DST' instead in /home1/scforum/public_html/index.php on line 51

Fatal error: require_once() [function.require]: Failed opening required '/QueryString.php' (include_path='.:/opt/php52/lib/php') in /home1/scforum/public_html/index.php on line 51"

Don't know what to do... ?!  ???

Thanks in advance!

S.
Samker's Computer Forum - SCforum.info

margarett

Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Samker

Quote from: margarett on November 10, 2015, 04:09:11 AM
Please check if Settings.php has valid content ;)

I'm sorry but I must to ask - how to do that?

I didn't change anything, error simple occur "without reason".  >:(
Samker's Computer Forum - SCforum.info

margarett

You need to check your SMF files (either via FTP or cPanel's File Manager). There you'll find a file Settings.php, open it and check if it has valid content (don't put its content here, it's sensitive information!)

Eg, this is my test SMF file (it's not a problem for me to show this because it's just accessible from my local machine):
<?php

/**
 * Simple Machines Forum (SMF)
 *
 * @package SMF
 * @author Simple Machines http://www.simplemachines.org
 * @copyright 2011 Simple Machines
 * @license http://www.simplemachines.org/about/smf/license.php BSD
 *
 * @version 2.0
 */

########## Maintenance ##########
# Note: If $maintenance is set to 2, the forum will be unusable!  Change it to 0 to fix it.
$maintenance 0; # Set to 1 to enable Maintenance Mode, 2 to make the forum untouchable. (you'll have to make it 0 again manually!)
$mtitle 'Maintenance Mode'; # Title for the Maintenance Mode message.
$mmessage 'Okay faithful users...we\'re attempting to restore an older backup of the database...news will be posted once we\'re back!'; # Description of why the forum is in maintenance mode.

########## Forum Info ##########
$mbname 'My Community'; # The name of your forum.
$language 'english'; # The default language file set for the forum.
$boardurl 'http://localhost/smf2'; # URL to your forum's folder. (without the trailing /!)
$webmaster_email '[email protected]'; # Email address to send emails from. (like [email protected].)
$cookiename 'SMFCookie891'; # Name of the cookie to set for authentication.

########## Database Info ##########
$db_type 'mysql';
$db_server 'localhost:3306';
$db_name 'smf2';
$db_user 'root';
$db_passwd '';
$ssi_db_user '';
$ssi_db_passwd '';
$db_prefix 'smf_';
$db_persist 0;
$db_error_send 1;

########## Directories/Files ##########
# Note: These directories do not have to be changed unless you move things.
$boarddir 'C:\\xampp\\htdocs\\smf2'; # The absolute path to the forum's folder. (not just '.'!)
$sourcedir 'C:\\xampp\\htdocs\\smf2/Sources'; # Path to the Sources directory.
$cachedir 'C:\\xampp\\htdocs\\smf2/cache'; # Path to the cache directory.

########## Error-Catching ##########
# Note: You shouldn't touch these settings.
$db_last_error 0;


# Make sure the paths are correct... at least try to fix them.
if (!file_exists($boarddir) && file_exists(dirname(__FILE__) . '/agreement.txt'))
$boarddir dirname(__FILE__);
if (!
file_exists($sourcedir) && file_exists($boarddir '/Sources'))
$sourcedir $boarddir '/Sources';
if (!
file_exists($cachedir) && file_exists($boarddir '/cache'))
$cachedir $boarddir '/cache';

$db_character_set 'utf8';
?>
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Samker

Quote from: margarett on November 10, 2015, 04:37:09 AM
You need to check your SMF files (either via FTP or cPanel's File Manager). There you'll find a file Settings.php, open it and check if it has valid content (don't put its content here, it's sensitive information!)

Eg, this is my test SMF file (it's not a problem for me to show this because it's just accessible from my local machine):

---


You're right... "Settings.php" is empty file. :o

How did this happen? Am I hacked?

... and the most important thing - How to fix this issue?

I have some little bit older backup - is it enough to copy-paste Settings.php from there ??

THANK YOU!
Samker's Computer Forum - SCforum.info

Samker

Quote from: Samker on November 10, 2015, 05:36:02 AM
---

I have some little bit older backup - is it enough to copy-paste Settings.php from there ??

---

Update:

I just did this... and forum is now Up again. :)

---

However, I need more advice(s) for this case:

- Is now everything Ok?

- Why is this happened? Hacking?

- How to prevent new problem?

Thank you in advance!

S.
Samker's Computer Forum - SCforum.info

margarett

Quote from: Samker on November 10, 2015, 05:49:55 AM
- Is now everything Ok?
Yes ;)

Quote from: Samker on November 10, 2015, 05:49:55 AM
- Why is this happened? Hacking?
No, don't worry you were not hacked. It's called a RACE condition, basically 2 processes were accessing the file at the same time and it resulted in a failed write operation, which emptied the file.

Quote from: Samker on November 10, 2015, 05:49:55 AM
- How to prevent new problem?
Unfortunately you can't. But:
a) it's not expected to happen and, when it does, it doesn't happen often. Most (most!) users use SMF for years without ever knowing that issue. Most likely you'll never see it again ;)
b) SMF stores a Settings_bak.php together with the main Settings.php which allows you to quickly recover
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Samker

Quote from: margarett on November 10, 2015, 06:18:08 AM
---

Quote- How to prevent new problem?

Unfortunately you can't. But:
a) it's not expected to happen and, when it does, it doesn't happen often. Most (most!) users use SMF for years without ever knowing that issue. Most likely you'll never see it again ;)
b) SMF stores a Settings_bak.php together with the main Settings.php which allows you to quickly recover

a) Yes, this is first time in my 8 Years with SMF 8)
b) I checked that, but for some reason both files were empty (because of that I copied file from old backup)


Finally, one more time, thank you very much for all help!

All The Best,

Samker

P.S.

I'll mark Topic as solved in the next few sec.
;)
Samker's Computer Forum - SCforum.info

Samker

Hi All,

Last night I experienced same problem again and resolved it on the same way.

However, I'm wondering... is this a matter of coincidence or to suspect on some technical problem or even hack ??

Thank You!

S.
Samker's Computer Forum - SCforum.info

noaccess

I'm experiencing this on a 1/2 days per week basis now for the past 3 months. It's really frustrating and the forum members think the site is hacked every time and I'm losing members at a very fast rate.

Who the hell codes like this anyway? Why would you write code that rewrites the settings file? wth?

Illori

Quote from: noaccess on November 26, 2015, 04:49:29 AM
Who the hell codes like this anyway? Why would you write code that rewrites the settings file? wth?

it is a bug, we did not code it to do this. it also only happens rarely if you consider how many SMF forums are in use. this bug has been resolved in the next version but that version is not released for general use yet.

Samker

Quote from: Illori on November 26, 2015, 05:58:14 AM
---

it is a bug, we did not code it to do this. it also only happens rarely if you consider how many SMF forums are in use. this bug has been resolved in the next version but that version is not released for general use yet.

Great, thank you very much for clarification.

When can we expect next update?

Also, until that, is there anything We can do to prevent this issue?
Samker's Computer Forum - SCforum.info

Kindred

There is nothing to be done, really...  keep a backup and be ready to restore it -- seriously, except for one or two people, it seems to be a rare occurence.

And by "the next version" we do not mean the next patch.  We mean 2.1 which is currently in beta and will not be released out of beta for some time yet.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

margarett

There is no reason for it to happen that often. Settings.php is only written in very, very rare ocasions so the odds of this condition to occur are very low.

You can prevent the file from being written by setting it low permissions on the server. 444 should work.
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Samker

Guys, thank you very much for detailed support.

I hoped that this issue will be resolved with v2.0.12. :-\

Until final solution, I changed permissions to 444... so far so good, but We'll see. ;)

Cheers!
Samker's Computer Forum - SCforum.info

Shambles

Quote from: Samker
I hoped that this issue will be resolved with v2.0.12. :-\

???

Quote from: KindredAnd by "the next version" we do not mean the next patch.  We mean 2.1 ...

Samker

Quote from: Shambles on November 28, 2015, 04:01:47 AM
Quote from: Samker
I hoped that this issue will be resolved with v2.0.12. :-\

???

Quote from: KindredAnd by "the next version" we do not mean the next patch.  We mean 2.1 ...

The emphasis is on the "I hoped". ;D

---

By the way, I'm sorry... English isn't my first language.

Samker's Computer Forum - SCforum.info

Advertisement: