0

I have a problem installing plugins on shared hosting.

When I try to install plugins recommended by a theme via the admin interface the process starts, outputs the message 'Unpacking package' twice (loose translation - could be a bit different in english) but the installation process never finishes - regardless if I try bulk install or single install.

The plugin ends up in the wp-content/upgrade folder but doesn't move from there. I tried to set permissions on the wp-content/plugins directory to 755, 766, and even 777 but the problem seems to persist.

Wordpress tries to install plugins via FTP. In my wp-config.php file I tried putting:

define('WP_DEBUG', true); // Does not produce errors on frontend
define('WP_DEBUG_LOG', true); // Does not create a log file with errors
define('WP_MEMORY_LIMIT', '64M'); 
/** 
  Following can be substituted by real values but the few seconds of time saved
  are not worth the vulnerabilty it causes. 
  Should NOT be used on shared hosting due to security concerns.
 */
define("FTP_USER", "ftp_username"); 
define("FTP_PASS", "ftp_passs");

Using define('FS_METHOD', 'direct'); doesn't seem to be a good option here because the files would end up being owned by the server.

There are no errors on fronted the process just never finishes. Any ideas on what be causing this?

1 Answer 1

0

Well once again I posted too soon and figured out the solution shortly after. What worked for me was adding this to my wp-config.php file:

define('FS_METHOD', 'ftpsockets');

The above line tries to force Wordpress to use the PHP Sockets class when working with the filesystem - updating, installing etc.


For security concerns on shared hosting you should not store your FTP username and password in your wp-config.php file. So REMOVE these lines asap in case you are using them:

define("FTP_USER", "ftp_username"); // Substituted by real values obviously
define("FTP_PASS", "ftp_passs");
2
  • just keep in mind that while it might work for your current needs, what you are doing is basically having your account password stored in plain text on your shared hosting where any misconfiguration fault, or user escalation on the server might be used to reveal it. IMHO this specific wordpress feature should just be avoided, the 15 min a month it might save you do not worth it. Commented Mar 11, 2017 at 14:42
  • Yea I was going to remove it once the setup is finished. I am going to update the answer accordingly to include this caveat for future readers. Commented Mar 11, 2017 at 14:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.