
Originally Posted by
marain
The code that you asked me to try ran, except that it echo'd "Good afternoon" even though it ran before 9:00 a.m. local time.
You used the time(), correct? The timestamp should be forcing DateTime to use UTC (which is always a good idea for servers; you can convert to local time afterwards). Try this instead:
PHP Code:
$dt = new DateTime( 'now',new DateTimeZone( 'UTC' ) );
It should give you UTC time (i.e., +0:00). If you want to use a local time to start, use one of these instead of "UTC."

Originally Posted by
marain
yielded over 100 error messages. Only one of them related to this thread
Life is great, huh? Welcome to the wonderful world of debugging!
The shell_exec error refers to your use of the backtic operator (which is _exactly_ the same as using shell_exec()): you web host has disabled it. This is not uncommon at all, especially on shared hosts, since it gives full access to the server's system.
Most of the other warnings are about missing variables. You need to go through each script, near the lines the error mentions, and backtrack to make sure you've defined those variables somewhere.

Originally Posted by
marain
As to , for debugging purposes, I wanted to try to isolate the problem by removing everything, and then restoring portions, piece by piece. My thinking was this: I am in html and not PHP until <?php comes along. But if <?php comes along in code that has been commented out, it would be treated as part of the html comment. (Wrong!)
Well, good thinking (debugging)! However, as I mentioned in my last post, you don't switch "back and forth" between PHP and HTML. It's all PHP, and then the output is all HTML. I blogged about this a while back, if you're interested.
To comment out PHP code, you need to use PHP comments:
PHP Code:
<?php
// single-line comment
/*
multi
line
comment
*/
# alternate single-line comment
# (I only use these when I want to differentiate from other comments,
# such as making my comments look different than another person's comments.)
Bookmarks