Join Tom Geller for an in-depth discussion in this video Launching a Drupal site, part of Drupal 7 Essential Training.
Now we get to one of the hardest things in Drupal: actually launching the site. Up until now, we've done all of our development on local computers. But now we have to move all this to a Web server that's connected to the Internet. Unfortunately, there are literally dozens, if not hundreds of differences among Web hosts. I'll just show you how to get online using the most common basic system, an FTP program. This might not work for you on a step-by -step basis, but I'm hoping you'll get some tips from it that you can use. By necessity, I'll have to go through some parts quickly and without much detail.
When you run into problems, contact your web hosting provider. They'll be able to explain the quark specific to their system. I've already set up a hosting environment on webenabled.net, one of many hosting providers. My address, as you can see here, is 2trees.dev3.webenabled.net. I'll connect to it using an SFTP program. The one that I'll use here is available for both Mac and Windows and it's called FileZilla. You can get it from filezilla-project.org. I've already connected to the site using FileZilla.
Now as you know, Drupal is a combination of files and a database and then you have to connect the two. I'll move the files first. But before we do that, we have to keep in mind that the Acquia Drupal Stack Installer we were using on our local computer is set up for a multi-site installation. So we're going to have to change some things because the host we're using is going to expect only one site. So the first thing I do is I go back to my Drupal installations, which I've called 2trees. I open that up and then my sites folder. In here, I see all, which is where I store my modules and themes.
Those are things that go for all sites. There is also a default folder, which we haven't really used throughout this course. Then there is 2trees, which is what the Acquia Drupal Stack Installer knows to look for, because our site is called 2trees. However, this folder's name has to be specific to where it's hosted. So I'm going to change that. In this case, it becomes 2trees.dev3.webenabled.net. As you know, that's the domain that we're using. We'll have to make further changes, but for now, let's go back to our server.
When I logged in, it took us to this area, which is the top level of our user account. What we're looking for is the place where web files are stored. In this case, that's the folder called public_html. Again, this is going to vary from host to host, but this is a common one, public_html. I go inside it and I see this 2trees folder. When I open it up, we see what we actually get right now if we go to that site. In fact, if I click that link, all that we have is a simple page with the graphic on it.
I can prove that that's where we're going by deleting this page. Then let's revisit it and make sure that we're actually in the right place. Reload and indeed that change what we see. So far so good. Now we're ready to move over all of our files. I'll go back to the Desktop and this is the folder I'm going to move. It's going to be my folder called 2trees replacing this folder called 2trees. There are several ways of doing this. In this case, what I'll do is I'll delete this one and then I'll drag it in.
While that's uploading, and it's going to take a long while, let's move the database over. Again, this is a step that varies tremendously from host to host. Fortunately, this host, WebEnabled, offers the same graphical interface, PHP Admin, as we've been using. It works a little differently though as you'll see. In this case, we'll go back and we'll login to phpMyAdmin right here. That redirects us to another screen where I enter my username and password and Go. The biggest difference between this phpMyAdmin screen and the one you're used to is there is no Import tab.
We're going to have to create the database first and then move over the one that we have on our local computer. So I'll do that and again I'll call it 2trees and Create. Good! So we've created it. Now we just have to move over all of the parts of our old database. To make this clear, we couldn't import a whole database. Instead, we have to create the database, and then into that database we can import what we want. So now there is an Import tab here. I click it, then click Browse, and find the file that I want, and there it is.
Click Open and then Go. This process may take a few minutes. If it works correctly, you'll see a notice at the top saying that it's successful and we were. Now all our pieces are on the remote host, but we're not quite done yet. You see different environments vary in how they connect the files to the database. Those settings are in a file called settings.php, which is inside our site folder. We can change it on the server if we want or on our own source folder on our local machine. I'm going to do it locally, and then upload it using SFTP.
I just find it easier to use the local programs like Notepad++. To edit it, I'll go back to my Drupal installation on the local computer, go into sites, and here is that folder we renamed, and in there is our settings.php file. For safety, I'm going to copy it and paste it, just so that I have a backup, and then I'll just move that to the Desktop. Drupal lock some of these files for safety, so you might have to unlock this to edit it and then lock it again. The way you do that depends on your operating system. I'll just make sure on Windows by going in here to Properties. Nope! I'd already turned off Read-only, which is sometimes turned on. So I am OK.
Now I'll go in and edit it with Notepad. The settings that we want are typically down here under Database settings if you're using an AMP stack such as MAMP or WAMP. In fact, this is where it would usually be, around line 181. However, Acquia DAMP does some things a little differently. One of them being it puts all of it stuff at the end. So we go down there to edit it and here you see all of the specifications for connecting to the database. This is what we'll have to change. The first thing I'll do is I'll comment out the base_url. That has to do with multi-site installations, which we don't have.
Then I'll change the username in the database to what it is on the host. In this case, it's w_2trees. I also have to change the password. In this case, I just made it Drupal. If you remember from our WebEnabled screen, WebEnabled actually uses a different port number, and you can see that down here, 4926. So I'll have to change that as well. Again, this is specific to my host. Your own web host may be different. So I'll save that, go back to my Desktop, and make sure to lock it again for safety.
Now we're ready to move that over and our site should run just fine. I'll go back into FileZilla, find the same file on the server, and replace the one that's there. First, I'll delete the old one and then load in the new one. All right! Now we cross our fingers and hope. Let's test and see if it actually works. I'll go to my site and click the URL, 2trees.dev3.webwnabled.net. It works, amazing! So to recap, moving your site to the server is essentially a three-step process.
First, you move the files. Second, you move the database and third, you edit settings.php so it connects the two. But the devil is in the details, and again there is no way we can cover the many variations here. If you're not able to work it out, your best bet is to contact your web host provider. Good luck to you!
- Comparing Drupal with other content management systems
- Understanding nodes
- Creating basic content
- Adding blogs, discussions groups, and polls
- Subscribing to RSS feeds
- Creating new content types
- Managing users, roles, and permissions
- Creating and modifying block regions
- Adding menus
- Extending site capabilities with modules