WordPress The _Options Table And You

Success
No surprise …. Having migrated one of my WordPress sites. I expected to run into some un-for seen areas that would be lets call them “broken”
One of which is the autofill properties for the FTP credentials when doing an update or add on or deletion plugins is where this can bee seen.  After my migration and countless manual entries server, username pwd… and no saving of the user entries. I decided to explore why  and how.  On my other sites this data gets saved and updated. why not this time?
After many searches the consensus (at least for my searches) was/is to make an entry in the wp-config.php file… hmm I thought Well the files does contain some sensitive data… a little more is not going to hurt. I started to make the necessary entries. which would be like this.
an example:

define('FS_METHOD', 'direct');
define('FTP_BASE', '/usr/home/username/public_html/my-site.example.com/wordpress/');
define('FTP_CONTENT_DIR', '/usr/home/username/public_html/my-site.example.com/wordpress/wp-content/');
define('FTP_PLUGIN_DIR ', '/usr/home/username/public_html/my-site.example.com/wordpress/wp-content/plugins/');
// define('FTP_PUBKEY', '/home/username/.ssh/id_rsa.pub');
// define('FTP_PRIKEY', '/home/username/.ssh/id_rsa');
define('FTP_USER', 'my-ftp-username');
define('FTP_PASS', 'my-ftp-password');
define('FTP_HOST', 'ftp.my-site.example.com');
// define('FTP_SSL', false);

As I was making the entries i thought wait a min… even though this may work. why does it not already work? So I stopped!  This coupled with a few post’s claiming this modification  does not work. So at this point I have not tested this. YMMV.
With many other WordPress sites at my fingertips I started to sift thru the data. I know the answer would prob most likely lie within the sql database. Lets start their! My first query produced a winner. The _OPTIONS table. ( Excellent article here: http://code.tutsplus.com/tutorials/understanding-and-working-with-the-wordpress-options-table–cms-21119 )
WP_options-002
Inside my Options table was an entry containing my FTP credentials… I Observed. poured…. observed some more…. then went to my broken WordPress site and inserted a new record with some valid info… and SUCESS!!!!!!!!!!!!!!!!!!!!!!!!! It even updates now. so if the login info changes it updates the DB.
i have no idea how it actually works but it does. here is what I can pass forward.
WP_options-001

a:3:{s:8:”hostname”;s:11:”ftp.msn.net”;s:8:”username”;s:10:”willywonka”;s:15:”connection_type”;s:4:”ftps”;}

Using the same string as above. inside the {} and preceding some string lets say “s:10:”willywonka”” the s10 is the length of the string. So when you change yours to match your servers setting make sure the update the S values. Also , when doing the insert.  The only valuable info will be.
1: the record number. 2: the option_name must be “ftp_credentials” (without the quotes) 3: the value within basically the long string above.. 4: And autoload set to yes
This is it. go do a test manually type in the same info the first time. and from then on. enjoy the spoils.
last words…. YMMV! best luck though!
-S

Leave a Reply

Your email address will not be published. Required fields are marked *