Opened 11 years ago
Closed 11 years ago
#29635 closed defect (bug) (fixed)
4.0 - Installation step 0 fails, if FS_METHOD is set to ssh2 in wp-config.php
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | 4.1 | Priority: | low |
Severity: | normal | Version: | 4.0 |
Component: | Filesystem API | Keywords: | |
Focuses: | Cc: |
Description (last modified by )
Steps to reproduce:
1.) create a new WP installation (with a brand new database) under /var/www/mysite
2.) create a new user for ftp, e.g.
sudo adduser wpuser sudo chown -R wpuser:www-data /var/www/mysite sudo su - wpuser ssh-keygen -t rsa -b 4096 -C wpuser@<myhost> sudo chown wpuser:www-data /home/wpuser/wp_rsa* sudo chmod 0640 /home/wpuser/wp_rsa* sudo mkdir /home/wpuser/.ssh sudo chown wpuser:wpuser /home/wpuser/.ssh/ sudo chmod 0700 /home/wpuser/.ssh/ sudo cp /home/wpuser/wp_rsa.pub /home/wpuser/.ssh/authorized_keys sudo chown wpuser:wpuser /home/wpuser/.ssh/authorized_keys sudo chmod 0644 /home/wpuser/.ssh/authorized_keys # #you may need to install some packages #sudo apt-get update #sudo apt-get install -y php5-dev libssh2-1-dev libssh2-php # sudo service apache2 restart
3.) set the following values in wp-config.php
define('FS_METHOD', 'ssh2'); define('FTP_PUBKEY','/home/wpuser/wp_rsa.pub'); define('FTP_PRIKEY','/home/wpuser/wp_rsa'); define('FTP_USER','wpuser'); define('FTP_PASS',''); define('FTP_HOST','127.0.0.1:22');
Now navigating to install.php will fail step 0 at wp_can_install_language_pack()
WordPress database error Table '<db-name>.wp_options' doesn't exist for query INSERT INTO `wp_options` (`option_name`, `option_value`, `autoload`) VALUES ('ftp_credentials', 'a:3:{s:8:\\"hostname\\";s:12:\\"127.0.0.1:22\\";s:8:\\"username\\";s:0:\\"\\";s:15:\\"connection_type\\";s:3:\\"ssh\\";}', 'yes') ON DUPLICATE KEY UPDATE `option_name` = VALUES(`option_name`), `option_value` = VALUES(`option_value`), `autoload` = VALUES(`autoload`) made by wp_can_install_language_pack, WP_Upgrader->fs_connect, Automatic_Upgrader_Skin->request_filesystem_credentials, WP_Upgrader_Skin->request_filesystem_credentials, request_filesystem_credentials, update_option, add_option
Commenting our the FS_METHOD and the FTP_* values fixes the problem. Once the installation is through, one can uncomment them and everything seems to work just fine.
This doesn't seem to affect anything before 4.0 where, I believe, the steps in install.php were quite different, i.e. there was no wp_can_install_language_pack()
obviously
p.s. I hope I got all of the sftp user setup right above in step 2, but hopefully anyone looking into this will have the knowledge to set that up correctly. If not, this should help https://www.digitalocean.com/community/tutorials/how-to-configure-secure-updates-and-installations-in-wordpress-on-ubuntu
Change History (9)
#1
@
11 years ago
- Milestone changed from Awaiting Review to 4.0.1
- Priority changed from normal to low
#2
follow-up:
↓ 3
@
11 years ago
It fails completely, DB tables are never created. A PHP error is triggered, as I have all reporting off, I get 0 length response from the server.
Didn't think to try ?step=1 but at least I did a bit of debugging ... :)
#3
in reply to:
↑ 2
@
11 years ago
Replying to scibuff:
It fails completely, DB tables are never created. A PHP error is triggered, as I have all reporting off, I get 0 length response from the server.
I'm not sure how to trigger this.
The message comes from wpdb::print_error() and is not a PHP warning. By default the message wil be written into error_log and dies only in Multisite if DIEONDBERROR
is set. wp-admin/install.php dies only on second step.
#4
@
11 years ago
Hmmm, I'm not sure how to help with that. I basically had a brand new Ubuntu 14.04 image with apache, mysql and php installed via apt-get, dl-ed wp 4.0 un tarred created a new db, added the wp-user for sftp and created wp-config.php. I couldn't get to install.php as it was failing at $step = 0;
The way I got around it was to comment out the wp-config.php FTP settings, run the install and un-comment them. After that everything works just fine.
I think a viable solution would be not to try to update_options with the FTP settings during the install which is what @nacin has suggested I believe.
#5
follow-up:
↓ 6
@
11 years ago
- Description modified (diff)
A PHP error is triggered, as I have all reporting off, I get 0 length response from the server.
So have you tried it with reporting on too? What was the PHP error in detail?
#6
in reply to:
↑ 5
;
follow-up:
↓ 7
@
11 years ago
Replying to ocean90:
A PHP error is triggered, as I have all reporting off, I get 0 length response from the server.
So have you tried it with reporting on too? What was the PHP error in detail?
I included the error from apache error.log in my opening post. Do you need the stacktrace also or is that enough? I moved past the problem already so to reproduce again I'd need to create a brand new VM but should have time for that sometime on Tue or Wed if needed. Could even share the VM image then I guess ...
#7
in reply to:
↑ 6
@
11 years ago
Replying to scibuff:
I included the error from apache error.log in my opening post.
This part is just a log entry which shouldn't end in a white screen of death, so I think that there must be something else.
#9
@
11 years ago
- Component changed from General to Filesystem API
- Milestone changed from 4.0.1 to 4.1
- Resolution set to fixed
- Status changed from new to closed
I tested this out. ssh2 is a blast to get working. :) It worked fine and was able to install a language pack and everything. If the ssh2 connection failed for whatever reason, it would skip the language selection all together, as intended.
There are some error suppression @ operators scattered about the filesystem code. If you're hitting a whitescreen with no explanation why, I'd look into enabling xdebug.scream and seeing if it points out your problem.
Calling this fixed for 4.1 for [29749].
Does it fail, or does it just trigger an error but proceed to complete the install?
The issue is update_option() in request_filesystem_credentials() — there needs to be a WP_INSTALLING check there — but it appears to me like the install probably completes.
For the record you can bypass this with ?step=1.