Support » Localhost Installs » Plugin upload to install

  • I am using Linux Mint 19.1 with PHP, MySql & Apache2. I installed WordPress 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.

    https://i.stack.imgur.com/3FHm9.png

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

    Please help me.

Viewing 11 replies - 1 through 11 (of 11 total)
  • This is the file permission issue.

    Go to modify the wp-config.php file.

    Before this line /* That's all, stop editing! Happy publishing. */

    Add this code define('FS_METHOD', 'direct');

    Personally I suggest using FlyWheel Local on the Linux OS. I am using it on Ubuntu.

    If your site on live domain, I didn’t suggest this code define('FS_METHOD', 'direct');

    So, when you move your site to the live domain, don’t forget to delete it.

    I put 777 permission to WordPress directory.

    Did you do it recursively?

    Not only the folder 777 there are file permission for www folder with your username so I suggest uaing LocalWP or use that code.

    Simple.

    Better search on the Stackoverflow. Ask on the LinuxMint forum.

    Do not make your Linux life complicated.

    While it is possible to set the permissions so that updates and plugin + theme installs work, it is very fiddly, IMHO barely worth the trouble.
    On a localhost machine you have your full operating system file access, just use it to install the plugins and themes etc, similarly when you are editing files, just edit them, much easier than using the WordPress or network techniques.
    Like why use FTP to access your own files ?

    @rossmitchell @fahimmurshed @a2hostingrj

    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 ?

    Most of the time when the file values are blank like that it’s because the file was too large to be uploaded and your server discarded it before it got to the PHP system.

    To check that, find out how large the ZIP file is, and then go into your site in ‘Media -> Add New’ and check what the maximum upload file size there is.

    Thanks @catacaustic . You can check this https://i.stack.imgur.com/oQ1mM.png. My phpinfo is like this https://i.stack.imgur.com/stbJ3.png. Thanks.

    So… you can upload 76,294 TB? I don’t think that’s reasonable. 🙂

    Everything in your PHP info seems cranked to the max – and there’s no reason for that whatsoever. If those values were sane your server might be able to handle things – but there’s no possible way you’ll ever upload even 1,000TB before the server crashes, or at very least the browser will time out the request.

    I’d really suggest starting again, with it all. There is very likely some cause from you trying to max everything out that’s causing problems. Try again with everything at either default of just slightly higher values and see how things go. It’s also worth trying a different LAMP Stack package that can install and configure itself so you can get the right values, right permissions, and have things play properly together.

    Thanks @catacaustic .You can check my WordPress code in previous reply to find out the issue.

    $_FILES[ $form ][‘name’] is empty, has no value. Why ?

    What is the issue in my current LAMP Stack package ? I have to know. This is my local environment.

    Thanks.

    I installed 2 wordpress site in my local environment. Both are behaving same. How can I fix the issue ? How can I debug the issue ?

Viewing 11 replies - 1 through 11 (of 11 total)
  • You must be logged in to reply to this topic.