WordPress needs to access your web server?
It was Thursday night and I decided to learn some new tricks on WordPress. I started to build a test environment using Docker.
Here is my docker-compose.yml file:
version: ‘3.1’
services:
wordpress:
image: wordpress:5.2.2
restart: always
ports:
– 8080:80
environment:
WORDPRESS_DB_HOST: db
WORDPRESS_DB_USER: exampleuser
WORDPRESS_DB_PASSWORD: examplepass
WORDPRESS_DB_NAME: exampledb
working_dir: /var/www/html
volumes:
– ./src/:/var/www/html/
db:
image: mysql:5.7.25
restart: always
environment:
MYSQL_DATABASE: exampledb
MYSQL_USER: exampleuser
MYSQL_PASSWORD: examplepass
MYSQL_RANDOM_ROOT_PASSWORD: ‘1’
phpmyadmin:
depends_on:
– db
image: phpmyadmin/phpmyadmin
restart: always
ports:
– 5432:80
environment:
PMA_HOST: db
MYSQL_ROOT_PASSWORD: myUserPass
volumes:
db_data:
Then started my Terminal, and located the folder that my yml file stored, with the command:
docker-compose up -d
Everything went pretty smoothly. WordPress installed! Now I went to the second step and tried to install plugins and here comes the warning:
To perform the requested action, WordPress needs to access your web server. Please enter your FTP credentials to proceed. If you do not remember your credentials, you should contact your web host.
Googled this issue around and found the most simple and useful solution:
Add the following to wp-config.php:
define( ‘FS_METHOD’, ‘direct’ );
Problem solved!!! Happy end. Alright, time for a coffee break.