0
votes

I am using Linux Mint 19.1 with PHP 7.2, MySql & Apache2. I installed WordPress 5.3.2 in my LocalHost. Now when I try to upload Plugin ZIP file to install I face below error. I put 777 permission to WordPress directory.

enter image description here

I searched a lot in Google but could not get any solution.

Please help me.

UPDATE

I investigated the issue and found that below code of plugin-install.php is responsible for display ZIP file upload Form.

function install_plugins_upload() {
    ?>
<div class="upload-plugin">
    <p class="install-help"><?php _e( 'If you have a plugin in a .zip format, you may install it by uploading it here.' ); ?></p>
    <form method="post" enctype="multipart/form-data" class="wp-upload-form" action="<?php echo self_admin_url( 'update.php?action=upload-plugin' ); ?>">
        <?php wp_nonce_field( 'plugin-upload' ); ?>
        <label class="screen-reader-text" for="pluginzip"><?php _e( 'Plugin zip file' ); ?></label>
        <input type="file" id="pluginzip" name="pluginzip" />
        <?php submit_button( __( 'Install Now' ), '', 'install-plugin-submit', false ); ?>
    </form>
</div>
    <?php
}

Below code of class-file-upload-upgrader.php is responsible for upload handle.

public function __construct( $form, $urlholder ) {

    if ( empty( $_FILES[ $form ]['name'] ) && empty( $_GET[ $urlholder ] ) ) {    
        wp_die( __( 'Please select a file' ) );
    }

    ..............

}

Here $_FILES[ $form ]['name'] is empty, has no value.

Could anyone say why it is happening ?

2
On you local host you can just copy your plugin dir to /wp-content/plugins No need to upload through the wp admin! - VA79
Thanks @VA79, But I would like to solve the issue. - abu abu
Ok, Can you check the file permission on /wp-content/plugins ? - VA79
Thanks @VA79. Here is the file permission. i.stack.imgur.com/YmdzB.png - abu abu
That should be ok. Hmmm i think your problem is with php file upload settings but thats not my expertise! Sorry! - VA79

2 Answers

1
votes

check php.ini upload_max_filesize and post_max_size

upload_max_filesize = 20M
post_max_size = 21M
1
votes

Install php-zip by executing sudo apt-get install php-zip in terminal. And then try again ...