Thank you for your input.
The error messages doesn't say that /ticker doesn't exist. It says that it cannot open it.
Code: Select all
drwxr-xr-x 2 nervous psacln 4.0K Apr 20 17:09 .
drwxr-x--- 49 nervous psaserv 4.0K Apr 20 03:08 ..
-rw-r--r-- 1 nervous psacln 117 Apr 20 17:08 test.php
-rw-r--r-- 1 nervous psacln 24 Apr 20 17:09 test.txt
-rw-r--r-- 1 nervous psacln 116 Apr 20 02:45 ticker.sav
-rw-r--r-- 1 nervous psacln 1.4K Apr 21 13:35 ticker.txt
-rw-r--r-- 1 nervous psacln 1.8K Apr 20 16:48 writeticker.php
This script has been running since 2002 without a problem. But now if I execute is from a browser it fails. I can get it to work but then the files are owned by Apache. I wasn't ware that one couldn't write to the webroot and that is good information. But it doesn't relate to this case. I used FTP to move the files to another server and never deleted them from this server. I changed back just by changing the NS records. The only time that it was ever migrated was when we moved from Ensim to Plesk years ago.
There were no special permissions. /ticker was chmod 0755 and ticker.txt was 0644. I fopen/fwrite 'w' creates the file if it doesn't exist in /ticker.
This process is working correctly as a cron with safe mode off. That's what doesn't make sense. I am wondering if mod_sec is doing something?
This is very, very frustrating because my anal intentive mind has to KNOW what I have done wrong!
Here is the entire codeblock that has worked all these years but now drives me bananas!
Code: Select all
function writeticker($database_sbnconnect, $sbnconnect) {
mysql_select_db($database_sbnconnect, $sbnconnect);
$query_recent = "SELECT datesent, timesent, sendernum, region, pagecode, agency, frequency, talkgroup, details FROM alerts ORDER BY datesent DESC, timesent DESC LIMIT 10";
$recent = mysql_query($query_recent, $sbnconnect) or die(mysql_error());
// write to ticker file
$row_recent = mysql_fetch_assoc($recent);
$FilePointer = fopen("ticker/ticker.txt", "w");
do{
$Data = sprintf("%s | %s | %s | %s | %s | %s | %s | %s | %s",
$row_recent['datesent'], $row_recent['timesent']." PT", $row_recent['region'], pagecode($row_recent['pagecode'], $database_sbnconnect, $sbnconnect),
$row_recent['agency'], $row_recent['frequency'], $row_recent['talkgroup'], $row_recent['details'], $row_recent['sendernum']);
$Data .= "\n";
fwrite($FilePointer, $Data);
} while($row_recent = mysql_fetch_assoc($recent));
fclose($FilePointer);
return;
}
// end function
Thanks again for the help from all of you. That's what I love about AT!