-
- 322 Posts
I uploaded a site to a client's server (not a hosting service I've used before), and here's what happens. After logging into the manager, as long as I stay in the Manager I can edit as much as I want. As soon as I view just one page on the front end, I get logged out of the Manager. What could the problem be? I haven't had this problem with any other host.
Check all your times. Server time, php and mySQL should all be set to match time. I ran into this on an incompatible server and found all these timezone settings to be different. In the end I had to move the site off the server anyway.
You can run this script to show all three time settings.
<?php
//get the values we need to log into the mySQL server with
include 'core/config/config.inc.php';
//php date
$arr['php'] = date("F j, Y, g:i a");
//mysql
$link = mysql_connect($database_server, $database_user, $database_password);
if (!$link) {
die('Could not connect: ' . mysql_error());
}
if (!mysql_select_db($dbase)) {
die('Could not select database: ' . mysql_error());
}
//get the mySQL time
$result = mysql_query("SELECT NOW();");
if (!$result) {
die('Could not query:' . mysql_error());
}
$arr['time'] = mysql_fetch_array($result);
//returns the system timezone.
$result = mysql_query("SELECT @@system_time_zone;");
if (!$result) {
die('Could not query:' . mysql_error());
}
$arr['systimezone'] = mysql_fetch_array($result);
//returns the session timezone if it differs from the system timezone.
$result = mysql_query("SELECT IF(@@session.time_zone = 'SYSTEM', @@system_time_zone, @@session.time_zone);");
if (!$result) {
die('Could not query:' . mysql_error());
}
$arr['sestimezone'] = mysql_fetch_array($result);
mysql_close($link);
$times = 'php time is: '.$arr['php'].'
';
$times .= 'mySQL time is: '.$arr['time'][0].'
';
$times .= 'mySQL system timezone is: '.$arr['systimezone'][0].'
';
$times .= 'mySQL session timezone is: '.$arr['sestimezone'][0].'
';
return $times;
-
- 322 Posts
I ran the script and got two times, which match (php time and mysql time).
It should have shown the server time as well (I think, I remember three times showing)
Maybe a call to the host is in order.
-
- 322 Posts
Looking at your script, the variable $times is constructed from just the php time and mysql time, plus system and sesssion timezones (which also matched when I ran the script).
Yeah, I saw that too (which is why I stuck the "I think" in there). Although when I ran it on that server, for some reason I thought I got three different times listed in the result. Obviously I am not remembering correctly.
I didn't write the script. As if... heh
-
- 322 Posts
It turns out the problem was because the hosting company had database caching turned on. They turned it off, and all is well.