Support » Fixing WordPress » Plugin install onlyhalf working

  • I spent yesterday setting up the new WP plugin and file uploader. Since I want to use ssh2 access, I installed ssh2.so, etc. The good news is that that portion is working. PHP5 (Version 5.2.6-1+lenny3) reports:

    Registered PHP Streams: zip, php, file, data, http, ftp, compress.bzip2, compress.zlib, https, ftps, ssh2.shell, ssh2.exec, ssh2.tunnel, ssh2.scp, ssh2.sftp

    So far so good, and the good news aren’t even over yet. I can authenticate successfully. When I select a plugin for installation, it is being downloaded and extracted. Then things go wrong. This is how it looks:

    Installing Plugin: Live Mobile Phone News Ticker 1.0

    Downloading install package from http://downloads.wordpress.org/plugin/live-mobile-phone-news-ticker.1.0.zip.

    Unpacking the package.
    Installing the plugin.
    Incompatible Archive
    Plugin Install Failed.

    I tracked the problem down as follows. What fails is the call to dir() in function dirlist(), file wp-admin/includes/class-wp-filesystem-ssh2.php.

    $dir = @dir('ssh2.sftp://' . $this->sftp_link .'/' . ltrim($path, '/') );

    $dir ends up being empty, which in turn leads the installer code to believe that the archive it just extracted was empty.

    Method install_package() in class-wp-upgrader.php:

    elseif ( count($source_files) == 0 )
        return new WP_Error('bad_package', $this->strings['bad__package']);

    My best guess at this point is that dir() is not happy with the ssh2.sftp URL. If I replace the code in wp-filesystem-ssh2.php shown earlier with a simple $dir = @dir($path, '/');, it all works fine. The plugin is successfully extracted and subsequently visible in the list of installed plugins.

    I am pretty confident that there is something messed up in my setup, because if this were a general problem, others would have already noticed and reported it. So, does anybody know why dir() is not doing the right thing for me if it’s fed an ssh2.ftp URL? The other file operations seem to be quite happy with it. I doubt, therefore, that it’s as simple as PHP not recognizing the URL format. Also, PHP specifically claims to know ssh2.ftp URLs as per phpinfo() output.

    Thanks,
    -Markus

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi,

    Check with these options:

    -> Assign 766 recursive permissions to wp-content directory.
    -> Disable all the plugins.
    -> Upgrade your wordrpess to the latest version.

    Thanks,

    Shane G.

    Thread Starter mmayer

    (@mmayer)

    No such luck. Just tried it using the latest WordPress from SVN trunk, a fresh check-out with no plugins installed or enabled, same result.

    However, I make this code change:

    $ svn di ./wp-admin/includes/class-wp-filesystem-ssh2.php
    Index: wp-admin/includes/class-wp-filesystem-ssh2.php
    ===================================================================
    --- wp-admin/includes/class-wp-filesystem-ssh2.php	(revision 12131)
    +++ wp-admin/includes/class-wp-filesystem-ssh2.php	(working copy)
    @@ -334,7 +334,7 @@
     			return false;
    
     		$ret = array();
    -		$dir = @dir('ssh2.sftp://' . $this->sftp_link .'/' . ltrim($path, '/') );
    +		$dir = @dir($path);
    
     		if ( ! $dir )
     			return false;

    And it works.

    Installing Plugin: Guest Blogger 1.4.1

    Downloading install package from http://downloads.wordpress.org/plugin/guest-blogger.1.4.1.zip.

    Unpacking the package.

    Installing the plugin.

    Successfully installed the plugin Guest Blogger 1.4.1.

    Actions: Activate Plugin | Return to Plugin Installer

    ericreal72

    (@ericreal72)

    i have the same problem! I always get the “plugin install failed” message.
    i dont know much about doing it all in code, so can you please write how to do the code changes step by step?

    Or is there another way to do it?

    thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Plugin install onlyhalf working’ is closed to new replies.