I'm writing this post in the hopes that it will help someone else. I am by all means new to Drupal and so maybe this information is old hat to a lot of you but for all those beginners out there maybe this will save you some heartache.

How to Move Your Local Acquia Dev Desktop Site to an Online Server

So you made your Drupal 7 site using Acquia Dev Desktop and now you want to put it on the internet for all to see. It took me a couple of tries but now I've gotten it figured out (at least this works for me). If you found a better way to do this please share!

1) THE MOST IMPORTANT STEP: Make a backup of all your files. Copy them somewhere else on your local machine and don't touch them. These are for later in case you mess anything up.

2) Install/activate the Backup and Migrate module on your local site. Use it to make a zipped backup of your files and database. This is for later in case you mess anything up.

3) Go to your control panel for your hosting account/server. Create a new database. Write down the database name, username (usually also the database name) and password.

3) Using the Acquia Dev Desktop application, select your site in the dropdown and then click on "Manage my database". This will open phpMyAdmin. Go to the Export tab. Make sure "Add DROP TABLE / VIEW / PROCEDURE / FUNCTION / EVENT" is checked. Choose compression zipped and download the file.

4) Uncompress and open the file you just downloaded using a text editor. At the top of the file remove this line CREATE DATABASE `databasename` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;

5) COMMON GOTCHA: Below that line it will say USE `databasename`;
What is there currently is the database that you setup in Acquia. Doublecheck what you wrote down for your database name that you just setup on your hosting account. Did it start with a prefix like the username for your hosting account? If so, change it to say USE `hostingprefix_databasename`;

6) Go back to your hosting account and import the database file you just edited. Click on Import, browse for the database file and click Go/Upload.

7) Using FTP transfer your entire development folder contents up onto your server.

8) Go into the sites/yoursite folder and edit the settings.php file. Scroll to the bottom where it says DO NOT EDIT... ACQUIA... etc and ignore that. Change as per below:

$base_url: 'http://www.yoursitename.com';

'database' : 'newDatabaseName';
'username' : 'databaseUsername';
'password' : 'databasePassword';
'host' : '';
'port' : '';

Note: I left 'host' and 'port' blank with just quote marks and that worked for me. You may need to configure them more.

9) Duplicate this revised settings.php file and copy it over into sites/default (there is a file there called default.settings.php, just leave it)

10) GOTCHA: Navigate to your site on the web. Do you get a Server Error! 500 page instead of your drupal site? Then go to your site root and edit the .htaccess file (this may be a hidden file that you need to reveal). Edit it and comment out the following by putting a # symbol infront of them:
Options -Indexes
Options +FollowSymLinks

11) Now if you go to your site, it should be there! If your images are missing another GOTCHA is that you may need to comment out all the lines (there are 3) in the .htaccess file residing in the site/files folder

Good luck! I hope this helps someone.

Comments

VM’s picture

This post is better served in the post installation forum or as a documentation page.

ashkel’s picture

Okay thanks. I've moved this post.

Maplinx’s picture

Very helpful post indeed. I previously used xampp and today decided to trial acquire drupal which was alright but needed to clarify how to transfer files to the web. Thanks ashkel for this post.

backtosamoa’s picture

Hi ashkel, thanks for the guide. When I try to import the edited SQL file at step 6 I get the following error message from my host server:

SQL query:

--
-- Database: `information_schema`
--
CREATE DATABASE `information_schema` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;

MySQL said: Documentation
#1044 - Access denied for user 'memoril8'@'localhost' to database 'information_schema'

Any ideas what might be causing this error message? I'm pretty sure I followed all the steps up to 6 correctly but I have no idea how to fix this, any help would be much appreciated.

Thanks

soroush_abn’s picture

images missing in my drupal site and i changed this configs and my site work fine.

1) copy all sites/YOURSITENAME files to sites/default.
2) change Temporary directory in /config/media/file-system to sites/default/files/temp.
3) change Public file system path in /config/media/file-system to sites/default/files.

I hop help u.

Anonymous’s picture

I followed these instructions exactly, and my site loaded perfectly the first time. THANK you for this, I've been tearing my hair out up till now.

One thing I will note: when I started my site using the acquia dev desktop, I didn't "create a new site" using the application, I "imported" a vanilla version of drupal that I downloaded from drupal.org. I understood that Acquia added some of it's own flavor to its distribution, and I just wanted a plain old drupal.

Also I'm using Hostgator (which so far seems pretty drupal friendly).

Thanks again for this!

Adrenaline-2’s picture

I dont understand or see the part 3), can someone explain a bit more? all i see is a slected list and i dont see a zip compression option.... maybe a screen shot of that would be helpfull, thanks :)

Adrenaline-2’s picture

got it... you had to check the "Custom - display all possible options" first

pavi_raghu’s picture

Hi,
I followed the same steps as above but getting 404 page not found error. Please help me what should i do.

VM’s picture

page not found error when doing what?

was clean urls enabled in acquia?
is mod_write enabled on the server?
did you move the .htaccess file?
did you clear the cache tables in the database before or after the move?

jasonaaronwood’s picture

Thanks for posting this. Things were going well until I reached steps 4 and 5...In my database file there is no such text to delete or edit. I tried importing the database anyway and it said the import was successful but there's a broken non-site there when I visit the URL, http://www.petsittingdc.com/

It's just giving me this stuff, looking for a "common.inc" file:
------------------

Warning: require_once(/home/content/40/5305940/html/petsitting/includes/common.inc) [function.require-once]: failed to open stream: No such file or directory in /home/content/40/5305940/html/petsitting/includes/errors.inc on line 62

Fatal error: require_once() [function.require]: Failed opening required '/home/content/40/5305940/html/petsitting/includes/common.inc' (include_path='.:/usr/local/php5_3/lib/php') in /home/content/40/5305940/html/petsitting/includes/errors.inc on line 62

------------------

EDIT: Okay, so I solved THAT problem - for some reason it took 3 tries for the common.inc file to actually upload. It was skipped over when I uploaded the whole site. Then I manually uploaded it again, and it still wasn't there. The 3rd time I refreshed my FTP window and it was indeed there, and now I have a new error:

------------------

Error
The website encountered an unexpected error. Please try again later.
Error messagePDOException: SQLSTATE[HY000] [2003] Can't connect to MySQL server on '127.0.0.1' (111) in lock_may_be_available() (line 167 of /home/content/40/5305940/html/petsitting/includes/lock.inc).

------------------
I can see that IP is the problem - I just don't know where to change it yet.

jasonaaronwood’s picture

I had to go back into the database and replace every instance of the IP and then re-import it. That fixed that problem....

NOW, the site's almost there... the text & the webform content is showing but the theme isn't coming through (I've set folder permissions to 777 all over the place to try to pinpoint the problem but to no avail).
http://petsittingdc.com - Now in the middle of the site's front page content, there's this error:
-------
Error message

Warning: file_put_contents(temporary:///.htaccess) [function.file-put-contents]: failed to open stream: "DrupalTemporaryStreamWrapper::stream_open" call failed in file_create_htaccess() (line 498 of /home/content/40/5305940/html/petsitting/includes/file.inc).

jasonaaronwood’s picture

Got rid of the error...now there's just no theme. And the site's in a subdir of another unrelated drupal site (piggy-backing hosting) so there seem to be .htaccess issues.

VM’s picture

did you clear the database cache? I ask because the logo.png file can be reached directly in the browser.

Chris McGrath’s picture

This is fairly sad that we have to go through all this and troubleshoot to boot due to NOT using the Acquia network. What is the thought behind the architecture of this tool? This is adding hours to moving a site from local to remote. And insures that GIT is now very out of sync with local and remote. Thus insures one cannot use this tool when using GIT and a remote host other than Acquia. Not the best design unless using for Acquia network for sure. I would say do not waste your time.

Gigi_’s picture

I am using Dev Desktop 2 beta
All I did was:

  • turn off clean url's in Drupal configuration on local site
  • backuped my files
  • made a backup of the dbase with the module backup & migrate
  • exported the dbase thru phpMyAdmin in Dev Desktop as explained in the original post
  • unzipped it
  • created a new dbase at the hosting provider customer portal
  • imported the unzipped .sql file in the new dbase on the live server thru phpMyAdmin
  • ftp all the local files from the site to the server
  • filled out the datebase data (name, pasword, host) on the new site
  • site runs, no issues so far.
ruyguy’s picture

I'm also using Dev Desktop 2.

I created a new database on the webserver, when I go to import the database from devdesktop it says:

"MySQL said:

#1046 - No database selected "

The database I created isn't showing up on the left sidebar of PHP admin, any ideas?

Can you clarify what you mean when you say, "filled out the datebase data (name, pasword, host) on the new site"? Are you referring to the site settings?

Thank you!

rick_p’s picture

There are a lot of good ideas provided in both the original post and in some of the comments. The best ideas are the ones about creating backups of your local code base and database (DB) before you start. The rest of it I'm not so sure about. I have been using a similar method that is far less work and less prone to failures.

Please note that this method is most useful for people using web hosting providers that don't allow SSH connections, most shared hosting do not. If SSH connectivity is available though, it behoves you to install and learn to use a code repository like GIT.

  1. Turn off Clean URLs
  2. From the Dev-Desktop console, click on the Local Database link, which opens phpMyAdmin, click the export button and export your database. There is no need to compress it yet, nor do you need to change any of the default settings. After you've exported it, check the size and make sure it's not too big to import at your web host. If it is, you will have to export it again from dev-desktop, but this time using compression, either gzip or regular zip is fine. Save the uncompressed copy.
  3. Optionally, make a duplicate copy of the entire folder that contains your Drupal code base and files, just to be on the safe side.
  4. Upload (via FTP) your codebase and files to your web host.
  5. Use your web host's console to access mySQL or phpMyAdmin and create an empty database. Make note of the DB name, username and password, host address, and port number if applicable. Don't import your DB yet!
  6. Here is where it gets easy, it's an extra step but makes it far more fool proof, which will save you time in the end. Open a browser and visit your site. I know it sounds crazy but do it. Drupal will not find a database and will invoke you to install Drupal like a fresh install. I know this goes against your intuition, but proceed. Why? because Drupal will first make sure your host provides all the resources necessary to run Drupal, and it will overwrite your settings.php file, which was set up for dev-desktop when you uploaded it, but now Drupal will configure it for you to run as a website hosted on the web instead of as localhost.
  7. Once you've gone through the setup process and your looking a fresh install of Drupal on your screen, go back to your web host's console and use phpMyAdmin to drop all the tables Drupal just created. Don't delete the database, just drop all the tables.
  8. Now import your DB. If you get an error about utf8mb4, open the uncompressed copy of your DB with a code editor or plain text editor and find the line near the top of the file that mentions utf8mb4 and simply remove the mb4 part, leaving the utf8 part, save the file, compress it to a zip file, and try importing at your host again.
  9. If the import succeeds, which most likely it will, go visit your site, all should be well now.
  10. Turn on clean URLs.

I have found this method to be less problematic than other methods. If you have installed a lot of modules your code base might be pretty large, and FTP is not the most reliable way to upload a lot of data so if you get any error messages relateded to specific modules, which I have before, try re-uploading those modules, that usually fixes those errors.

Your local development environment will not be affected by any of this, which is why I said it's optional to make a backup copy of your code base, but bear in mind that the copy of settings.php is now different on the server than the copy on your local machine, so if you want to backup your site after doing more work on it after it's been migrated to the web, that's fine, but don't download it to the same folder as your local copy if you want dev-desktop to continue to work. This is the reason why most advanced developers use a code repository like GIT, because it allows you to have version control and helps prevent overwritting work that you've done locally. The rule of thumb is to never, ever upload your database after the first time you launch the site. Code base yes, that's how you install security updates, but database no. You develop (code) locally push (upload) that to your site, but your database only comes downstream once the site is live and working. The only files that ever come downstream (for backup purposes) are images, PDFs, and other files of that nature, files that are usually in the sites/default/files folder or similar.

sbcllc’s picture

Rick, even three years later, the information you've presented for easily migrating a Drupal website from Acquia Dev Desktop 2 to a live server have come in handy as I've been trying for the better part of yesterday until now to migrate a Drupal 8 test site from my local machine to my live server with a persistent error being displayed. Doing it your way allowed for whatever settings and configurations I could not quite track down as a result of using the Acquia Dev Desktop 2 to be updated without me having to dig through the config files. After dropping the initialized DB for the exported DB from the local website, everything came to life with no problems.

Thank you very, very much as I will be committing your method to memory (in addition to committing it to a document that I can reference later on).

rick_p’s picture

Glad it helped. 😊

SoCalErich’s picture

So I'm about to have to do this for my D8 site that I have locally in Dev Desktop 2. I'm glad I found this article. The only point I'm confused on is how do I disable/enable Clean URL's for D8? I'm not finding anything on that. 

THANKS

SoCalErich’s picture

So I actually just skipped the part about turning off/on clean URL's and followed the rest of the steps and it worked perfectly. THANKS.

rick_p’s picture

👍

andycamps’s picture

Hi rick_p,

thanx for the great set of instructions. I created a site with drupal/recommended-project in composer running under Acquia Dev Desktop. Followed all the steps (including an upload that took forever) and the site is running fine now!

rick_p’s picture

I’m almost surprised these instructions still works after all this time, but very pleased they do 😀

rachmann’s picture

Why not just add an 'else' to the 'if' (with a server path version 'require' once you also copy the loc_[sitename]_dd.inc to your server as well? Then update the connection params in the inc file. That way you don't destroy how Dev Desktop works.

RazedandRisen’s picture

I had big issues moving my site from Acquia Dev Desktop but this saved me. I'm getting a strange warning in the admin but that's it "Warning: include_once(/core/themes/classy/classy.theme): failed to open stream: No such file or directory in include_once() (line 145 of core/lib/Drupal/Core/Extension/Extension.php)."

Thank you for this!

rick_p’s picture

But then again, this part of Drupal hasn’t changed much. That is indeed a strange error because the classy theme is part of core so it seems unrelated to the migration from devdesktop to server. I guess the first thing I would check is to make sure that path (/core/themes/classy/classy.theme) is valid in relation to site root.