The only way I know how to do this is to read the file into an array and then output it leaving out the line you don't want:
$fpin = file( "filename" );
$fpout = fopen( "filename", "w" );
foreach ($fpin as $line)
{
if ( $line != "what you want to exclude" )
{
fwrite( $fpout, $line );
}
}
fclose( $fpout );
You can use flock on the file if you want to make sure that no one else tries to write to it at the same time. If you only want to check to see if the line contains a specific string use a strstr statement in the if statement.