Hi, I am moving an existing MODx site from one server to another.
I imported the database through cpanel + phpmyadmin and I made a backup of the existing home directory in cpanel and uploaded them to the new server too.
I have changed the database details in content/manager/includes/config.inc.php but I get the following error. It seems MODx is still looking to the old server for the database location. How do I change where MODx looks for the database location?
PHP error debug
Error: mysql_connect() [function.mysql-connect]: Access denied for user ’caplush_shopUse’@’localhost’ (using password: YES)
Error type/ Nr.: Warning - 2
File: /home/caplush/public_html/content/manager/includes/extenders/dbapi.mysql.class.inc.php
Line: 85
Line 85 source: if (!$this->conn = ($persist ? mysql_pconnect($host, $uid, $pwd) : mysql_connect($host, $uid, $pwd))) {
Parser timing
MySQL: 0.0000 s s (0 Requests)
PHP: 0.0282 s s
Total: 0.0282 s s
Looks like you’re using an incorrect username/password combination for the mysql database. Did you check in CPanel if the database has an user, and do those settings match the config file?
René
Yeah its looking at the wrong url thats why. If I change the config.inc.php back to that accounts mysql db details, it will run perfectly. In fact if I login into the manager and change some text in a document on one account it will also change it on the other - the two sites are looking at the same original url path. I just don’t know how to change the URL path on the new "moved" site cause MODx looks like it generates it automatically in the config.inc.php file.
I have no url in the config file, so this is a bit confusing.
Did you change the nameservers so it points to the new server? Or do you access the new server with a different URL? How do you know if you’re looking at the old or the new server? Make sure you have no redirects on the new server using the domain that maybe still points to the old server.
René
thanks for your time nightsignals.
From Line 17 to 31 of config.inc.php, MODx appears to set the URL of the website. This is what I am referring to:
Line 17 reads: // automatically assign base_path and base_url
Line 31 reads: $site_url .= $base_url;
Actually I haven’t been totally accurate too, my apologies.
I have a reseller webhosting account. So technically there aren’t two different servers involved.
Instead I have two accounts, both of them using the same server but they are two separate accounts with separate URL’s, i.e. www.mydomain.com/~usernamea and www.mydomain.com/~usernameb. (If you wanted to access the accounts not by their domain names, you can use the usernames of the webhosting account)
OK I got it sorted out. This is how I did it:
The password seemed to be one of the reasons it wasnt working. Unlike xCart, I had a problem with having a $ in my MODx database password.
In the end I edited two files:
Lines 6 to 11 in the manager/includes/config.inc.php file
and lines 94 to 102 in the index.php in the root directory.
All sweet now! Thanks again nightsignals for your time...