Transfer my website from linux to windows

Hello guys,

I want to transfer my website from linux to Windows (wamp server).
I configured my .env file, my virtual hosts and hosts files but when i want to connect to my website i have this message :

Error establishing a database connection

Though my database has been created

Do I need to configure anything else?

Thanks for your help

What kind of software/server/solution are you using for hosting the WordPress site on Windows?
Container-based (Docker Desktop)/on WSL (2)?
Some other solution?

Sorry, details are missing :confused:
So i have :
Windows 11 :
Wamp server 3.2.6
Apache : 2.4.51
Php : 7.4.26
MySql : 5.7.36


So the PHP(-FPM) must be able to connect and authentify with the MySQL server.
Are the database configuration fields in .env correct (database username, database password, database host, database port, database name)?
Was a database created on the MySQL server for that site and an user added/assigned to it with sufficient permissions (create tables, alter tables, …)?

Thank you for your answer Strarsis.

Yes, I have a database and the .env configuration is correct :


# Optionally, you can use a data source name (DSN)
# When using a DSN, you can remove the DB_NAME, DB_USER, DB_PASSWORD, and DB_HOST variables

# Optional database variables
# DB_HOST='localhost'
# DB_PREFIX='wp_'


It s a full access user

Ans this my virtual host config :

type or paste code here<VirtualHost *:80>
	DocumentRoot "c:/wamp64/www/omerci/backend/web/"
	<Directory  "c:/wamp64/www/omerci/backend/web/">
		Options +Indexes +Includes +FollowSymLinks +MultiViews
		AllowOverride All
		Require local

And my host config :

This database connection error in relation to a WAMPP server brings up some workarounds:

So the database host (DB_HOST environment variable) should be changed from its default (localhost) to an IPv4 loopback address ( (not all localhost resolve equal).

Thank you for your help @strarsis.
I changed my DB_HOST (bedrock>config>application.php) like this *:

 * DB settings
Config::define('DB_NAME', env('DB_NAME'));
Config::define('DB_USER', env('DB_USER'));
Config::define('DB_PASSWORD', env('DB_PASSWORD'));
Config::define('DB_HOST', env('DB_HOST') ?: '');
Config::define('DB_CHARSET', 'utf8mb4');
Config::define('DB_COLLATE', '');
$table_prefix = env('DB_PREFIX') ?: 'wp_';

but nothing changed. I have the same message.

*As you know, in bedrock wp-config.php contain nothing. all the config is on .env file.

Changing the .env would be sufficient. But in any case, this change doesn’t appear to fix the issue.

Is the database server actually running?
Is it listening on that port?
Temporarily disable the Windows Firewall and try again.

Yes, The database is running correctly. I deployed two other bedrock just for test and all is good.
The only différence that i see it’s that the first web site was transfered from linux server :confused:

The error message

indicates that the database connection doesn’t work. That is the underlying issue.

Can you check the PHP error logs, are there details about the connection error (host not found, connection timeout, authentication failure)?

I have those messages :

[19-Jun-2022 17:56:33 UTC] PHP Fatal error:  Uncaught Error: Class 'Config' not found in C:\wamp64\www\omerci\backend\web\app\db.php:5
Stack trace:
#0 C:\wamp64\www\omerci\backend\web\wp\wp-includes\load.php(549): require_once()
#1 C:\wamp64\www\omerci\backend\web\wp\wp-settings.php(124): require_wp_db()
#2 C:\wamp64\www\omerci\backend\web\wp-config.php(9): require_once('C:\\wamp64\\www\\o...')
#3 C:\wamp64\www\omerci\backend\web\wp\wp-load.php(55): require_once('C:\\wamp64\\www\\o...')
#4 C:\wamp64\www\omerci\backend\web\wp\wp-blog-header.php(13): require_once('C:\\wamp64\\www\\o...')
#5 C:\wamp64\www\omerci\backend\web\index.php(6): require('C:\\wamp64\\www\\o...')
#6 {main}
  thrown in C:\wamp64\www\omerci\backend\web\app\db.php on line 5

I don’t understand from where come this file “db.php” and what is his function. Maybe it’s a mistake from I
I deleted it just for seeing but it the same result.

Hm, are you using a recent Bedrock for the site?
An unmodified Bedrock doesn’t have a web/app/db.php:

Perhaps a modification or a plugin that placed the file there for autoloading (some caching plugins need to do this)?

Yes, I m using a recent Bedrock.
I think also it’s a plugin or mistake because I reinstalled other site in the same configuration and there is not problem.
Thank you for your Help @strarsis

What are the contents of db.php? Any special hooks for the database connection?

db.php is what’s called a “dropin plugin”. They’re poorly documented, but that file is almost certainly added by a plugin. I can’t speculate which one, but you could look at its content, or disable all plugins, delete dp.php and the selective re-enable plugins and see which one cases the file to be added.

1 Like