Saw an interesting blog post to Twitter today about storing WordPress FTP information in wp-config.php. The article is written in German so I sent the author a email to ask if he ' d mind me translating it. Phil, the author, very kindly said yes–so my translation is below.
Since The addition of the Automatic Updates in the WordPress core became available, there have been the possibility of FTP Data in the backend. Then you can get both plugins and the core by clicking on the date. However WordPress then stores the login information in the blog database. This can is a potential security issue. If someone were to gain access to your database then they would also has access to your entire server. One of the reducing the risk is to use the approach outlined below.
Editing wp-config.phpaccess
The wp-config.php file can be used to define constant values so, the usage of a database can be removed. This makes the database smaller, and so improves site performance. For the FTP access the constants is as follows and should is added to the bottom of your wp-config.php file:
Define ('ftp_host'ftp.example.org');
Define (' Ftp_host ', ' ftp.example.org:2121 ');
Define ('ftp_user'username '
Define ('ftp_pass'password');
Secure Connection
For a secure connection add the following line (Default:false):
Define ('ftp_ssl'true);
Directories
If The WordPress installation is isn't in the root directory of the the FTP server can define the location as follows:
Define ('ftp_base','... ');
Moved the plugin directory or all of the content folder? You can also specify the full path using these-constants:
Define ('ftp_content_dir' ... ' );d efine ('ftp_plugin_dir'... ');
Method
Finally, you can also adjust the method to being used by WordPress for the file system. This often hides errors if something goes wrong with the file permissions. You should errors occur, and most of the time the default would work just fine.
Define ('fs_method'Direct');
The following methods is possible:
- Direct (default) –php file system functions
- ssh – ssh PHP Extension
- ftpext –ftp PHP Extension
- ftpsockets –php Socket extension
The constants Ftp_pubkey, Ftp_prikey Display the paths to the SSH public key and private key ssh specify.
Delete Existing Data
If you ' re unsure whether access data already stored on WordPress, you can search the WordPress options in the database usi ng the following page on your website:
http://example.org/wp-admin/options.php
There should search for the Entry:ftp_credentials
If This is present, you have already stored the FTP data in your database. You can delete it by simply removing the value of the Ftp_credentials field on the Options page and then scrolling to the bot Tom, and pressing Save. You should being very careful doing this though as there are potential for your website to being broken when doing this.
More information
Further information can is in the WordPress Codex:
- Editing wp-config.php (WordPress Upgrade Constants)
Easy WordPress Updates:store FTP Info in wp-config.php