When a WordPress plugin installation fails with The package could not be installed. PCLZIP_ERR_MISSING_FILE (-4) Missing archive file error, think out of the box to find the root cause.
This is the error message I receive when I tried to install Yoast SEO plugin but it may happen for any plugins such as Jetpack, Akismet, Wordfence, Contact Form 7, WooCommerce, and many others:
Installation failed: The package could not be installed. PCLZIP_ERR_MISSING_FILE (-4): Missing archive file ‘tmp/wordpress-seo.17.8-0v58HG.tmp’
While trying to install the plugin manually, I ran into The disk-write test failed error:
Error: Command #0 failed. It reported the following error: The disk-write test failed to write 1 MB to a temporary file (/home/panel/.cPquotatest.6195a.1d7.113) because of an error: open(/home/panel/.cPquotatest.6195a.1d7.113): Disk quota exceeded (EUID: 3742).
The root cause for both errors is the same. The solution is below.
Solution for Installation Failed PCLZIP_ERR_MISSING_FILE error
The problem was the file usage limitation in my GoDaddy hosting plan. There is a limit of 250,000 files to have in my entire hosting account. Apparently, the plugin files that were extracted from the plugin zip file caused this limit to be exceeded.
In my GoDaddy cPanel dashboard, I saw this message in the STATISTICS section on the right side of the page:
It’s not fair to have a quote like this for an “unlimited” hosting plan but this is how GoDaddy and many hosting companies operate, unfortunately.
Finding the root cause took some time but the fix was easy. I just needed to delete some abandoned sites of mine and also removed some emails. Then I retried installing the WordPress plugin. It was completed successfully.
After removing files to go below File Usage quota, you may come across Is its parent directory writable error next time you try to install a plugin. Check out this post for the step-by-step solution: WordPress error: “Is its parent directory writable by the server?”