strtotime("09/Jun/2006 11:56:12") returns -1
The log is a space-delimited file, the [ and ] should be quotes since there's a space in between.
Just grousing. More trouble than I'm used to for a bulk copy operation.
Here's what worked (the goal being to move yesterday's log to a table without using the sql INPUT command):
// read srclog
$srclog = "../logs/yourownstrippoker.com/http.1168349/access.log.0";
$rawlog = file_get_contents($srclog);
// fix the damned date
$pattern = array ('@/Jan/@', '@/Feb/@', '@/Mar/@', '@/Apr/@', '@/May/@', '@/Jun/@',
'@/Jul/@', '@/Aug/@', '@/Sep/@', '@/Oct/@', '@/Nov/@', '@/Dec/@',
'@[(d{2})/(d{2})/(d{4})@',
'@:(d{2}):(d{2}):(d{2}) -0(7|8)00]@');
$replace = array ('/01/', '/02/', '/03/', '/04/', '/05/', '/06/',
'/07/', '/08/', '/09/', '/10/', '/11/', '/12/',
'"3-2-1',
' 1:2:3"');
$newlog = preg_replace($pattern, $replace, $rawlog);
// write newlog
$handle = fopen("./lastlog.txt", "w");
$logbytes = fwrite($handle, $newlog);
fclose($handle);
// import log to table
$s = "mysqlimport --fields-optionally-enclosed-by='"'
--fields-terminated-by=' ' --lines-terminated-by='n'
--user=xxxxxx --password=yyyyyy --local
--host=dbhost.yourownstrippoker.com log_db ./lastlog.txt";
exec($s);