The easiest way to clear, or empty a file is to copy null device to the file. Useful for purging Apache and PHP error logs.
# send null device to purge httpd, php logs
sudo cp /dev/null /var/log/apache2/php-error.log
sudo cp /dev/null /var/log/apache2/access_log
sudo cp /dev/null /var/log/apache2/error_log