WordPress error : “To perform the requested action, connection information is required.”

Maybe you ever find this image when you want to install new plugin or theme on your wordpress website :

wp connection error WordPress error : “To perform the requested action, connection information is required.”

One of the great features of WordPress is that it allows you to automatically install and upgrade plugins, automatic download it from wordpress.org download center.

A common problem is that WordPress is unable to access the filesystem directly, which results in a page indicating that “To perform the requested action, connection information is required.

What is Causing This?

Whenever you use the WordPress control panel to automatically install, upgrade, or delete plugins, WordPress must make changes to files on the filesystem.

Before making any changes, WordPress first checks to see whether or not it has access to directly manipulate the file system.

If WordPress does not have the necessary permissions to modify the filesystem directly, you will be asked for FTP credentials so that WordPress can try to do what it needs to via FTP.

Why Can’t WordPress Write To The Filesystem?

In order to understand why WordPress can’t write to the filesystem, we need to take a look at some WordPress internals.

The following code is from the get_filesystem_method() method in the wp-admin/includes/file.php file:

if( function_exists('getmyuid') && function_exists('fileowner') ){
    $temp_file = wp_tempnam();
    if ( getmyuid() == fileowner($temp_file) )
        $method = 'direct';
    unlink($temp_file);
}

For the non-PHP people:
1. It checks to see if the getmyuid() and fileowner() functions are available and activated.
2. It calls wp_tempnam(). This function gets the PHP-defined temporary directory and creates a temporary empty file in it.
3. It checks to see if the owner of the just-created temp file is the same user as the owner of the update script itself. This would indicate that WordPress is running with the same credentials as the person who installed it. In other words, it checks to see if you’re running suPHP.
- Before it’s done, it deletes the temp file.

If any of these three checks fail, then you have to put in FTP credentials. This is because, in these cases, WordPress does not have enough local rights to be able to correctly overwrite its own files. So it has to get FTP info in order to FTP back to itself, as you, and thus obtain those rights. It can’t escalate its own privileges.

Short version:
1. You need to have PHP configured to allow getmyuid and fileowner to work.
2. You need to be running suPHP.
3. Your temporary file directory needs to be defined correctly.

Most normal hosting setups do this by default. Use of suPHP is fairly standard, as it’s safer from a security standpoint.

What hhould we do with that ?

In order to fix this issue, you will need to make sure that the scripts which need to write to the filesystem are owned by the same user that apache is running as.

Many hosting companies will run your apache instance using your user account, and all of your files will be owned by the same account. In those cases, you will probably not have the issue described here.

If your hosting company is running apache as a system user, and your files are owned by your own account, your only option may be to enter your FTP credentials here and allow WordPress to use FTP.

If you are running on a hosting company that gives you root access, or you have installed WordPress on your own development machine at home or at work, you should be able to modify the filesystem permissions to allow WordPress to directly access the filesystem.

The easiest way to do this is to find out what user apache is running as and change ownership of the entire WordPress directory to that user. For example, if apache is running as ‘httpd’, you could use the following commands on your WordPress installation directory:

# chown -R httpd: wordpress

Note that not all versions of chown are equal. If that command does not work, see your local chown man page for usage information.

Incoming search terms:

3 Comments »

  1. avatar comment-top

    this happen to my blog
    unfortunedly, i don’t have root access
    what can i do to fix this?

      

    comment-bottom
  2. avatar comment-top

    Thanks for th solution its a great help..

      

    comment-bottom
  3. avatar comment-top

    Another way is to change the permission of your folders, set it to be 755 (rwxr-xr-x)

      

    comment-bottom

RSS feed for comments on this post. TrackBack URL

Leave a comment