Question

How to fix "WordPress Connection Information" on WP that is running in a docker container ?

Hello,

I have a WP website is running in a docker container. I am using all offical images (WP, MariaDB).

I have a problem that is I can not upgrade WP, plugins, install new plugins, delete unsed plugins,… from WP admin dashboard

In non-docker enviroment, I met the same problem and fix it by the command “chown apache:apache /path/to/wp”. Now on docker I don’t know how to resolve it.

Give me some guide, please.

Thanks in advance.

Best regards,


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Accepted Answer

If you’re using Docker-Compose, you’ll want to run bash or sh into your Wordpress service container:

sudo docker-compose exec WORDPRESS_SERVICE_NAME sh

When done correctly you should find yourself within the Wordpress /var/www/html directory inside the container. You want to make sure you’re in the same directory that the wp-config.php file is located.

Open wp-config.php with your text editor of choice and add the following line to the end of the file:

define('FS_METHOD','direct');

Save or write the changes to the file and navigate back to the Wordpress update page, it should now be able to update without needing the FTP connection information.

Thanks to http://www.hongkiat.com/blog/update-wordpress-without-ftp/ for the tip.

After you’ve finished updating you can always go back and comment out the addition if you’re worried you’ll have users on the server who might upload malicious code. You can read up on the security concerns for this here.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

works only with apache2 Use this code , wordpress asking for ftp details because wordpress doesn’t have permission to write in your server. use these two commands in terminal.

$sudo a2enmod rewrite $sudo chown -R www-data /var/www

video guide https://www.youtube.com/watch?v=RGGWVUIvhnk

Thank you, it works on normal lamp mod_php over Centos 7 also.