How to delete a line from the file with php? May 23, 2022 by Tarik Read the lines one by one, and write all but the matching line to another file. Then replace the original file.