Wordpress localhost ftp

Wordpress localhost ftp

  1. Blog
  2. 15 November 2026
  3. 3 min read

Stefan Bogdanescu

Founder & Senior Architect

Why WordPress Asks for FTP Credentials on Localhost

When you encounter a prompt for FTP hostname, username, and password immediately after installing a plugin in a local environment, it usually indicates that the application has lost track of your file system permissions or is misconfigured to use remote access instead of direct disk I/O. The specific scenario described—running WordPress on Mac Lion with localhost set to 127.0.0.1 and facing repeated credential prompts—suggests that wp-config.php contains a configuration directive instructing the application to upload files via FTP rather than using the local filesystem.

The core issue is often a misunderstanding of how virtual hosts interact with file permissions versus network credentials. Even if your server runs entirely on 127.0.0.1, WordPress treats an FTP connection as a distinct network protocol. If the application cannot write directly to the directory where the plugin resides (often due to incorrect ownership or restrictive Unix permissions), it falls back to the FTP uploader, assuming you want to manage files remotely.

To resolve this without guessing passwords, you must inspect your wp-config.php file in the root of your WordPress installation. Look for a block of code resembling the following:

define( 'FS_METHOD', 'ftp' );
// Or potentially defined as 'ext-ftp'

If FS_METHOD is set to 'ftp', WordPress will ignore local file system permissions and attempt an FTP connection every time it needs to create directories or upload files. The default hostname in this configuration block is typically localhost. You do not need to guess a username or password derived from your MySQL user or OS admin account; these are unrelated services. Instead, you must use the credentials for the FTP server running on your machine.

If you are using MAMP, XAMPP, or a similar stack on Mac Lion, the default FTP credentials are often found in the application's configuration file (e.g., mamp-mysql.conf or specific FTP settings in the preferences). Common defaults might be user: mamp with password: mamp, or simply root with an empty password, depending on how the stack was initialized. However, relying on these defaults is fragile.

The most robust solution is to remove the FTP dependency entirely. You can do this by editing wp-config.php and changing the line:

define( 'FS_METHOD', 'ftp' );

to:

define( 'FS_METHOD', 'direct' );

Once you set FS_METHOD to 'direct', WordPress will attempt to use local file system operations directly. If this fails, it will then try the shell command method, and finally fall back to FTP only if necessary. This approach aligns your application with the reality that you are running on a localhost environment where direct disk access is faster and more reliable than tunneling through an FTP protocol.

After making this change, ensure your web server directory permissions allow the user running the PHP process to write files. On macOS Lion, this typically involves ensuring the www directory is owned by the same user group as your web server (often _www for Apache) or that the directory permissions are set to 755 or 775 depending on your security posture.

By switching from FTP to direct filesystem access, you eliminate the need to configure FTP credentials and avoid the latency and complexity of remote file uploads during plugin management. This is the standard practice for local development environments unless you have a specific requirement to use SFTP for security or cross-platform compatibility reasons.

Our network