Hey all,
When I first starting building my site locally I made the mistake of setting it up as a subdomain on Acquia, even though it is my main site (that is, instead of my site being at http://localhost:8082/, it's at http://mpa.localhost:8082/). Now however I want to put it online, but not as a subdomain (I want http://mpa.localhost:8082/ to show up at www.examplesite.com). I tried installing it according to some instructions, which basically went:
1. Go into phpMyAdmin and export the database (mpa.sql.gz)
2. Use an ftp client to move all the files from my mpa subdomain into public_html on my host server
3. Import the database using phpMyAdmin on the hostserver
4. Modify the $db_url string in settings.php
After doing this, when I go to my site I get the following error:
PDOException: SQLSTATE[HY000] [2003] Can't connect to MySQL server on 'examplecom.netfirmsmysql.com' (13) in lock_may_be_available() (line 167 of /hermes/bosweb/web151/b1512/nf.examplecom/public_html/includes/lock.inc).
I don't understand the error at all, but suspect it has to do with the fact that I was originally using a subdomain and didn't change something I should have.
Any help on how to fix this up would be greatly appreciated.
Comments
I'm assuming you are setting
I'm assuming you are setting up a Drupal 6 site since $db_url does not apply to Drupal 7.
It looks like you have an error in your $db_url string in the settings.php file. Be sure you are using the proper format and the username, password and database name for the db on your new hosting account. Typically you would use "localhost" as the host unless you are told otherwise.
$db_url = 'mysql://username:password@localhost/databasename';
See the "mysql://" part? Make sure you are starting with "mysql://" and not "mysqli://" until you get it working because I've seen PDO errors when a host doesn't support mysqli. You do want to use mysqli if possible though since it's a speed gain.
DrupalVoodoo
Hmm, actually it is a drupal
Hmm, actually it is a drupal 7 site so I guess $db_url is not what I want. Now I did also modify the following code in settings.php.
I tried switching host to 'localhost' instead of the netfirms host URL and still got an error. There are two things I'm wondering about that I might be doing wrong.
1. Above this there is a line with a $base_url value. Does that need to be changed, and if so, to what?
2. The port is what I'm using for sftp, is that the wrong port?
Thanks for your help!
Port and file setup
Your SSH port would not be the port you would connect with. MySQL's default port is 3306 so try it without any port option at all.
If you have a
$db_urlline somewhere in your settings.php file and since$base_urlnormally appears well below the db settings array in the settings.php file and not above it you may need to start with a fresh copy of the default.settings.php file.DrupalVoodoo
Thanks! That definitely led
Thanks! That definitely led to some progress, the site now displays more or less correctly. There are still a few oddities going on though.
First, some of the filenames of my images and documents broke (mostly everything that was capitalized had to be changed, so picture.JPG locally had to be changed to picture.jpg). This of course is easy to fix.
More complicated is that some site elements still think they are being hosted locally. For example, one of the images in a page I made is not displaying because it's looking for it at:
"http://MPA.localhost:8082/sites/..."
More problematically, the Log-in page is doing the same thing. Clicking on the log-in button gives an error saying I can't connect to "mpa.localhost:8082".
Any idea what might be causing these problems? And thanks again for your help so far, it's nice to have something online. :)
Did you clear your site
Did you clear your site caches? The simple way would be to go to the Performance page, admin/settings/performance, and clear cached data. Be sure you don't have any of your old data in your settings.php file as well.
For your file name issues a good solution is to use the transliteration module to normalise your file names, http://drupal.org/project/transliteration
DrupalVoodoo
That appears to have done the
That appears to have done the trick. I had to increase my php memory limit and then run an update script before it would let me clear the caches. But now that I have that all out of the way, everything seems to be working wonderfully.
Thank you very much.
Glad that took care of it. A
Glad that took care of it. A common motto with Drupal is "Keep calm and clear your cache."
While it may seem picky can you update your post title to include "[Solved]" as it really helps those of us looking for people to help skip things that have been resolved.
Happy Drupaling!
DrupalVoodoo