Reputation: 21840
I'm troubleshooting a php log file that has expanded way too rapidly and used up a lot of disk space.
What is the best way to clear a log file?
is it a problem to simply delete the log file? And will that log file be recreated as php tries to write to it?
Upvotes: 8
Views: 23839
Reputation: 129
You can run this simple command from terminal(in WHM) or From SSH terminal.
find -name error_log -type f -exec rm -rf {} \;
This command will find all files with name "error_log" and remove it.
Enjoy.
Upvotes: 0
Reputation: 66
It IS safe to delete the log file by doing the following:
Upvotes: 0
Reputation: 339
On Mac OS X 10.6 I deleted /var/log/apache2/error_log. Minor panic when it didn't re-appear upon refreshing my page. Just had to restart apache by going through the Sharing settings. Now she's back.
Upvotes: 3
Reputation: 924
It is entirely safe to just delete the php.log file. It will be auto-created the next time it is needed.
Upvotes: 19