user10926084
user10926084

Reputation:

How do I fix WordPress PCLZIP_ERR_MISSING_FILE (-4) : plugins error?

So I am trying to install recommended plugins from a WordPress theme after installing the theme but the plugins installing return errors. Below is the response for contact form 7:

Downloading installation package from https://downloads.wordpress.org/plugin/contact-form-7.5.2.1.zip… Unpacking the package… The package could not be installed. PCLZIP_ERR_MISSING_FILE (-4) : Missing archive file '/tmp/contact-form-7.5.2.1-ribBpT.tmp'

I read some inputs about adding some lines of codes into the wp-config file and adding the below and created a folder called "temp" under the contents folder:

/*Set WordPress temporary directory */
define('WP_TEMP_DIR', ABSPATH . 'wp-content/temp');

I then went back to refresh before I tried installing the plugin but the issue remained the same.

Here is what I have in the wp-config file:

/** Absolute path to the WordPress directory. */
if ( ! defined( 'ABSPATH' ) ) {
    define( 'ABSPATH', __DIR__ . '/' );
/*Set WordPress temporary directory */
define('WP_TEMP_DIR', ABSPATH . 'wp-content/temp');
}

/** Sets up WordPress vars and included files. */
require_once ABSPATH . 'wp-settings.php';

Am I missing anything here? If yes, how do I fix this?

Thanks!

Upvotes: 1

Views: 11096

Answers (3)

Alireza zolfaghar
Alireza zolfaghar

Reputation: 1

just add define('WP_TEMP_DIR', ABSPATH . 'wp-content/temp'); right after }! and create temp folder in wp-content/temp. if put cod inside {} won't work somthing like this will work:

 if ( ! defined( 'ABSPATH' ) ) {
    define( 'ABSPATH', __DIR__ . '/' );

}
define('WP_TEMP_DIR', ABSPATH . 'wp-content/temp');

Upvotes: 0

yommie
yommie

Reputation: 11

  1. Go to Your wp-content folder. You can access the wp-content folder by using a file manager on your hosting or using FTP. The location will be domain/wp-content (where domain is the website domain name)

  2. When you are in wp-content create new folder under wp-content and call it temp.

  3. Download your wp-config file from your server to your computer. This is just in case you make a mistake and have a backup which you can quickly restore. Open the wp-config file and search for the following line of code.

if ( !defined('ABSPATH') ) define('ABSPATH', dirname(FILE) . '/');

  1. Add following line of code after that line.

**/Set WordPress temporary directory / define('WP_TEMP_DIR', ABSPATH . 'wp-content/temp');

  1. Save the wp-config.php file. If you edited it on your PC upload it to the website

Upvotes: 1

Poliakoff
Poliakoff

Reputation: 1672

This might happen when you do not have space left on your disk drive. Check this with df -h.

Upvotes: 2

Related Questions