Tag Archives: ftp

Let WordPress remember your FTP credentials

I’ve found it quite useful to let WordPress remember my FTP information, so that adding new plugins/themes and doing security updates can happen quite quickly.

First, gather up your FTP username, password and host.
Next, open up the ./wp-config.php file. I like to put in the FTP information after the MySQL settings area:

[php]
/** Database Charset to use in creating database tables. */
define(‘DB_CHARSET’, ‘utf8’);

/** The Database Collate type. Don’t change this if in doubt. */
define(‘DB_COLLATE’, ”);

define(‘FTP_HOST’, ‘yourFTP_Hostname’);
define(‘FTP_USER’, ‘yourFTP_Username’);
define(‘FTP_PASS’, ‘yourFTP_Password’);
define(‘FTP_SSL’, false);
[/php]

To test it out, try to install a plugin.

In case of problems

2-3% of the time, WordPress has problems doing the FTP, even though I know that the information is correct. In that case, here is a workaround.

[sourcecode language=”plain”]
mysql>
mysql> select * from wp_options where option_name = ‘ftp_credentials’;
+———–+—————–+———————————————————————————————————-+———-+
| option_id | option_name | option_value | autoload |
+———–+—————–+———————————————————————————————————-+———-+
| 876 | ftp_credentials | a:3:{s:8:"hostname";s:12:"example.com";s:8:"username";s:8:"someUsername";s:15:"connection_type";s:3:"ftp";} | yes |
+———–+—————–+———————————————————————————————————-+———-+
1 row in set (0.00 sec)

[/sourcecode]

Take a look at what’s there, copy and paste it to a temporary safe place, then delete it from inside of MySQL:

[sourcecode language=”plain”]
mysql> delete from wp_options where option_name = ‘ftp_credentials’;
Query OK, 1 row affected (0.00 sec)

mysql>
[/sourcecode]

Switch back to your browser, and try installing the plug-in again. This time it should work.