Symptoms
Attaching files to email in RoundCube will fail with the following error.
An error occurred!
File upload failed.
The cPanel error log will have an error like the following.
[2021-05-19 03:55:29 -0400] info [webmaild] [fcgi] PHP message: PHP Warning: File upload error - unable to create a temporary file in Unknown on line 0
Description
Not being able to attach files in RoundCube can be caused by incorrect ownership or permissions on the /var/cpanel/userhomes/cpanelroundcube/tmp directory.
The issue can also be caused by issues with /tmp or /var/tmp, such as permissions, ownership, or running out of disk space or inodes.
Workaround
Change /var/cpanel/userhomes/cpanelroundcube/tmp to the correct ownership and permissions:
chown cpanelroundcube.cpanelroundcube /var/cpanel/userhomes/cpanelroundcube/tmp
chmod 700 /var/cpanel/userhomes/cpanelroundcube/tmp
Change the ownership and permissions on /tmp to the correct ownership and permissions:
chown root: /tmp
chmod 1777 /tmp
If you need to clear disk space or inodes, you can configure the tmpwatch program to clean files based on age.