Title: plugin installation error
Last modified: August 19, 2016

---

# plugin installation error

 *  [aneuryzma](https://wordpress.org/support/users/aneuryzma/)
 * (@aneuryzma)
 * [16 years, 10 months ago](https://wordpress.org/support/topic/plugin-installation-error/)
 * Hi,
 * I get the following error when I try to install a new theme or plugin. I’ve the
   latest wp 2.8
 * Warning: array_keys() [function.array-keys]: The first argument should be an 
   array in /Users/aneuryzma/Sites/wordpress/wp-admin/includes/class-wp-upgrader.
   php on line 180
 * thanks

Viewing 8 replies - 1 through 8 (of 8 total)

 *  Thread Starter [aneuryzma](https://wordpress.org/support/users/aneuryzma/)
 * (@aneuryzma)
 * [16 years, 10 months ago](https://wordpress.org/support/topic/plugin-installation-error/#post-1135904)
 * HI,
 * I guess the dirlist function is not returning anything.. is maybe because file
   permissions problem ? I can’t install any theme or plugin…
 *     ```
       $source_files = array_keys( $wp_filesystem->dirlist($remote_source) );
       ```
   
 * thanks
 *  Thread Starter [aneuryzma](https://wordpress.org/support/users/aneuryzma/)
 * (@aneuryzma)
 * [16 years, 10 months ago](https://wordpress.org/support/topic/plugin-installation-error/#post-1136088)
 * anybody can give me help ?
 * I just installed wordpress 2.8.1 and I tried to install the plugins and I got
   the same error.
 * thanks
 *  [lee-henderson](https://wordpress.org/support/users/lee-henderson/)
 * (@lee-henderson)
 * [16 years, 8 months ago](https://wordpress.org/support/topic/plugin-installation-error/#post-1136212)
 * I’m also having this problem on 2.8.4. It’s running on a Mac OS X 10.4.11 Server.
   PHP 4.4.4. Apache/1.3.33
 * Perhaps I’m running into a known problem with an older PHP/Apache?
 *  [darkman82](https://wordpress.org/support/users/darkman82/)
 * (@darkman82)
 * [16 years, 7 months ago](https://wordpress.org/support/topic/plugin-installation-error/#post-1136223)
 * I lost many hours over this too and, fortunately, I found the problem.
    There’s
   a conceptual bug. The engineer who wrote class-ftp-sockets.php pretends to read
   at most ONE line on the FTP Control Session, after each request (FTP Command),
   this works in most cases, but not always. In our case, when we do a “LIST -la”(
   follow dirlist function) the FTP server (Pure-FTP) answers with something like
   this:
 *     ```
       150 Accepted data connection
       226-Options: -a -l
       226 3 matches total
       ```
   
 * Now, take a look in _readmsg function (class-ftp-sockets.php):
    `$tmp=@socket_read(
   $this->_ftp_control_sock, 4096, PHP_BINARY_READ);` It tries to read 4K of data,
   no matter if one or many lines, then it tries to extract the FTP Server Reply
   Codes through regular expression: `$go = !preg_match("/^([0-9]{3})(-.+\\1)? [
   ^".CRLF."]+".CRLF."$/Us", $this->_message, $regs);`
 * BUT the previous pattern will match if and only if the string is a LINE, if not,
   thinking that we are in presence of a partial line, it tries to read again appending
   new incoming data in order to complete the LINE. Unfortunately, there is nothing
   to read and it fails with “Resource temporarily unavailable” message.
    _readmsg
   fails => _exec fails => _list fails => rawlist fails => dirlist fails => array_keys
   FAILS!
 * _readmsg is called by _exec every time we do a FTP command:
 *     ```
       $status=@socket_write($this->_ftp_control_sock, $cmd.CRLF);
                       if($status===false) {
                               $this->PushError($fnction,'socket write failed', socket_strerror(socket_last_error($this->stream)));
                               return FALSE;
                       }
                       $this->_lastaction=time();
                       if(!$this->_readmsg($fnction)) return FALSE;
       ```
   
 * Between socket_write and _readmsg we can’t know how many lines the FTP Server
   has flushed out on the ftp control stream then, we cannot assume to read at most
   ONE line or partial line.
 * At this point, a buffered reader seems to be necessary.
 * NOTE: I have this problem only in one server, on the others all works fine.
 *  [darkman82](https://wordpress.org/support/users/darkman82/)
 * (@darkman82)
 * [16 years, 7 months ago](https://wordpress.org/support/topic/plugin-installation-error/#post-1136224)
 * I solved by changing some lines of code in class-ftp-sockets.php.
 * Replace original class-ftp-sockets.php with this file [http://darkman.it/x/class-ftp-sockets.php.txt](http://darkman.it/x/class-ftp-sockets.php.txt)
   
   or use this patch [http://darkman.it/x/class-ftp-sockets.patch](http://darkman.it/x/class-ftp-sockets.patch)
   and let me know if it works for you too.
 *  [kirkvan](https://wordpress.org/support/users/kirkvan/)
 * (@kirkvan)
 * [16 years, 6 months ago](https://wordpress.org/support/topic/plugin-installation-error/#post-1136236)
 * darkman82, thanks much for taking the time to post your research. I’ve spent 
   hours trying to hunt down this solution. Instead of changing the code, in cPanel/
   WHM I switched from Pure-FTPD to ProFTPD. Problem solved (although I’d prefer
   to be running Pure-FTPD). I’ve wanted to use WordPress’ built-in updaters for
   many months, so thanks again.
 *  [ajinkyakulkarni](https://wordpress.org/support/users/ajinkyakulkarni/)
 * (@ajinkyakulkarni)
 * [16 years, 3 months ago](https://wordpress.org/support/topic/plugin-installation-error/#post-1136261)
 * [@darkman82](https://wordpress.org/support/users/darkman82/)
 * thanks for giving patch and replaced class. It really helped!
 *  [darkman82](https://wordpress.org/support/users/darkman82/)
 * (@darkman82)
 * [16 years, 1 month ago](https://wordpress.org/support/topic/plugin-installation-error/#post-1136266)
 * No problem 😉
    According to WP Trac, the patch will be applied to the 3.1 realease.
   [http://core.trac.wordpress.org/ticket/10831](http://core.trac.wordpress.org/ticket/10831)

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘plugin installation error’ is closed to new replies.

## Tags

 * [installation error](https://wordpress.org/support/topic-tag/installation-error/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 8 replies
 * 5 participants
 * Last reply from: [darkman82](https://wordpress.org/support/users/darkman82/)
 * Last activity: [16 years, 1 month ago](https://wordpress.org/support/topic/plugin-installation-error/#post-1136266)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
