Please keep in mind that the Comet Cache plugin for WordPress is a third party script that is not created by, provided by, or supported by cPanel. The investigation, diagnoses, and resolution of issues related to the Comet Cache plugin are tasks that are best handled by a systems administrator with the skills, training, and expertise required to do so for you. Although this issue is not related to cPanel or the basic configuration of cPanel, we would like to offer the following information as a courtesy.
You may find an error similar to the following when an automatic cache clear is executed, or when manually clearing the cache:
An error of type E_ERROR was caused in line 158 of the file
Error message: Uncaught Exception: Unable to delete files.
Rename failure on directory:
The fundamental cause of this issue is that the cache directory could not be altered.
There are multiple different potential circumstances that could lead to this error and comprehensively enumerating all of the potential causes in this guide is not possible.
However the workaround section below goes over some techniques that you may use to gather more details about this issue. If the following information is not enough for you to identify the cause and resolve the issue, you must either contact the plugin creator, or a systems administrator with the skills, training, and expertise required to resolve the issue for you.
Potential Cause #1 - File and Directory Permissions Problems
We have a guide that goes over the basics of using the find command to identify files based on permissions and ownership here:
How to find files based on permissions and ownership
One potential cause for this issue could be that the permissions of the directories or files within the cache directory are not set properly. Typically files should be set to have 0644 as the mode. You can generate a list of files that do not have 0644 as the mode with the following command:
find /path/to/comet/cache/directory -not -perm 0644 -type f
In a similiar vien, directories should typically be set to 0755 as the mode. You can generate a list of directories that do not have this permission set with the following command:
find /path/to/comet/cache/directory -not -perm 0755 -type d
If you do not get any output from those commands then the permissions are most likely set properly.
One notable exception would be the document root directories of websites. These directories typically should be set to 0750 rather than 0755. You should consult with your systems administrator if you are unsure about the results.
If you do get any output from those commands, you should consult with a qualified systems administrator to determine if the permissions are set appropriately for the specific setup that your server has. Then you may determine if the listed files could potentially be the cause of the error that you have encountered.
Another concern would be the ownership of the files and directories. Typically the files and directories would be owned by the cPanel username of the account. You can find files and directories that are not owned by the cPanel user with the following command:
find /path/to/comet/cache/directory -not -user cpanelusernamehere
find /path/to/comet/cache/directory -not -group cpanelusernamehere
If you find files or directories that are not owned by the cPanel user, you would, most of the time, fix those files and directories so that they are owned by the cPanel user.
One notable exception would be the document root directories of websites. The document root directory should have the group ownership set to the "nobody" user in most cases. Please consult with your systems administrator before making changes if you are unsure.
Another technique for reviewing file and directory ownership is to use the namei command. This command will list the permissions and ownership of every directory leading up to a file, as well as the permissions and ownership of the file its self. You would run the command like this:
namei -l /path/to/comet/cache/directory/or/file
If you find a problem with the permissions or ownership of a directory above a file, or with the file it's self, you would need to work with a qualified systems administrator to fix the permissions or ownership.
Potential Cause #2 - Filesystem Corruption
There are times when files and directories cannot be altered due to filesystem corruption. Typically you would also be seeing other wide ranging issues on the server if filesystem corruption is present. We have a guide that goes over the basics of identifying filesystem corruption here:
Identifying Disk Corruption and Filesystem Errors
Potential Cause #3 - Filesystem Attribute Configuration
If a file or directory is configured with the Immutable filesystem attribute, no changes can be made to the file or directory. You can check a file or directory for this with the instructions in this guide:
How to determine if a file or directory has the immutable attribute set
Potential Cause #4 - Coding or other Application related issues
It is also possible that the specific code in use on the WordPress site is preventing the plugin from operating properly. This may or may not be caused by the Comet Cache plugin its self and only an experienced systems administrator, WordPress Developer, or other person with specialized knowledge of WordPress and Comet Cache would be able to determine this for you. cPanel Support is not able to preform the system administration services to investigate this type of cause so you must reach out to either the Plugin Creator, a developer, systems administrator, or the WordPress community for assistance with this.
One example of this is the following defect that had been reported and fixed in 2015 for the Comet Cache plugin: