cPanel: Delete error_log & *php.error.log files Print

  • 1

Ever wanted to easily and quickly dispose of error_log and/or <domain>.php.error.log files on your cPanel server? Fortunately, there's a way to do just that!

find /home/* -path /home/virtfs -prune -o -type f -name error_log -exec /bin/rm -fv {} \;
find /home/* -path /home/virtfs -prune -o -type f -name *php.error.log -exec /bin/rm -fv {} \;

The above commands will search all of the cPanel accounts in your home directories for files named error_log and/or <domain>.php.error.log and remove any that it finds. It will also exclude /home/virtfs/, as files in this directory are read-only. It will create a list of the files that it removed, like so:

[email protected] [~]# find /home/* -path /home/virtfs -prune -o -type f -name error_log -exec /bin/rm -fv {} \;
removed ‘/home/testuser/public_html/error_log’
[email protected] [~]#


Was this answer helpful?

« Back


Ethernet Servers Ltd
124 City Road
London
EC1V 2NX


Registered Limited Company: #09114946
Telephone: +44 330 043 1258
Email: [email protected]

Copyright © 2013 - 2022 - Ethernet Servers Ltd - All Rights Reserved.

Proudly serving customers in 118 countries since September 2013!