Why WordPress Asks for Connection Info

One of the great features of WordPress is that it allows you to automatically install and upgrade plugins.

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.


Connection Information

If you feel that your WordPress installation should not be asking you for this information, or you simply do not want WordPress to use this method of plugin management, you may be able to work around it.

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';

This code creates a temporary file and confirms that the file just created is owned by the same user that owns the script currently being run. In the case of installing plugins, the script being run is wp-admin/plugin-install.php.

This may seem a little counter-intuitive, since the only thing WordPress really needs to be able to do is write to the wp-content/plugins directory.

What Can I Do About It?

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.

Tip: In order to find out what user your instance of apache is running as, create a test script with the following content:

<?php echo(exec("whoami")); ?>


No comments yet.

Leave a Reply