I’m trying to set up my Xampp htdocs location to a Google Drive folder so that I can work on my wordpress site from any location and also sharing it with my PC-laptop.
Following along some tips & tutorials (such as: how to change xampp htdocs directory in OSX?) I now can access my localhost. However, browsing to my wordpress site located in localhost/testsite/ results in:
‘Error establishing a database connection”
Any suggestions what can be wrong? Is it no possible to share htdocs-folder between PC & MAC?
my vhost.conf looks like (unchanged):
<VirtualHost *:80>
ServerAdmin webmaster@dummy-host.example.com
DocumentRoot "/Applications/XAMPP/xamppfiles/docs/dummy-host.example.com"
ServerName dummy-host.example.com
ServerAlias www.dummy-host.example.com
ErrorLog "logs/dummy-host.example.com-error_log"
CustomLog "logs/dummy-host.example.com-access_log" common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin webmaster@dummy-host2.example.com
DocumentRoot "/Applications/XAMPP/xamppfiles/docs/dummy-host2.example.com"
ServerName dummy-host2.example.com
ErrorLog "logs/dummy-host2.example.com-error_log"
CustomLog "logs/dummy-host2.example.com-access_log" common
</VirtualHost>
And the changes made to http.conf
DocumentRoot "/Users/username/Google Drive/htdocs"
<Directory "/Users/username/Google Drive/htdocs">
..
# User/Group: The name (or #number) of the user/group to run httpd as.
# It is usually good practice to create a dedicated user and group for
# running httpd, as with most system services.
#
User username
UPDATE:
I’ve tried to make some changes to my wp-config.php file accordingly to some threads on this problem.
/** MySQL database username */
define('DB_USER', '');
/** MySQL hostname */
define('DB_HOST', '127.0.0.1');
Changes
– Removed root from DB_USER
– Tried changing DB_HOST to both Localhost (notice capital L) and 127.0.0.1. This makes the wp-config-file compatible with PC but just wanted to troubleshoot.
Localhost throws parse error and 127.0.0.1 results in “Error establishing a database connection”
try accessing http://localhost/phpmyadmin and checking the credentials. Usually user is root and no password by default. Also, don’t forget to create a database for wordpress if you haven’t done so already. So your wp-config.php should contain something like this:
Architecturally, Google Drive was not designed for what you are trying to do. You may hack something together and get it working, but there are much better solutions.
git
based deployment strategy and have this box wherever you need it.gulp serve
locally and, if you have browsersync as part of your build script, it will watch your codebase, automatically make updates for you in the browser and allow you to remotely access your local dev box for cross-browser testing.Alright, solution to this is far from revolutionary. Of course its not only the htdocs-folder that has to be synced between the PC and MAC but also the MySQL data folder.
Exporting the database from phpmyadmin on the PC and importing it into my Xampp setup on Mac solve this problem with “Error establishing a database connection” message.