1. Home
  2. Training Library
  3. Amazon Web Services
  4. Courses
  5. How to Move Your Website to AWS with PHP, MySQL, and Apache

Extending the functionality of PHP

Start course

The combination of Linux, Apache, MySQL, and Python or PHP (LAMP) is one of the most common software stacks for web servers, even for high-end web applications. In this course, the experienced sysadmin David Clinton will teach you how to install and configure a LAMP stack on AWS EC2 and RDS, also discussing security issues and selecting the right instance type for your application.

This course will cover all the steps in the process: from creating an instance to building a website-hosting LAMP stack. You'll find everything you need to configure your webserver using EC2 (Elastic Cloud Compute) and RDS (Amazon Relational Database) to power your MySQL instance.

Who should take this course

This is a beginner course that aims to introduce basic AWS concepts to anyone looking for a quick guide to building a web server in the AWS cloud. We'll take you through all the basic steps, from configuring your Linux installation to using Amazon RDS to take advantage of AWS scalability.

You should have some basic Linux knowledge. If you are new to Amazon Web Services, why not watch our AWS Basics course or some of the other introductory courses to the common AWS services, like Amazon RDS

And feel free to test your knowledge on the basic topics covered in this course by taking a quiz.

If you have thoughts or suggestions for this course, please contact Cloud Academy at support@cloudacademy.com.


Hi. Welcome to our course on building a lamp server on EC2, Amazon's web service platform. Today we're going to be talking about your PHP installation. There are many modules or extensions that could be added to PHP, to extend PHP's versatility and power. We're going to look at the basic system that tells you what you have installed already, and what you could install. And we're going to take a look at one or two modules. First of all, just to see what's available, you can type from a command, @cash searchphp5-, which will give you a long list of available extensions, available modules. On the left, there's the title. The last one is php5-xhprof. And its description is it's a hierarchical profiler for PHP5. You can go through that entire list and see if any of them interest you or they're extensions that you need. If you want to install one, you simply type pseudo app get install.

And then, the name of that particular module. In this case, XHprof. Type enter and then enter your password, if that's the way you set up your user account, and you'll be off to the races. However, I should add that add that before you install any packages on a Debian or Ubuntu system, you should always first run pseudo app get update, which will make sure that the packages that you're looking for, the ones that are the most recent that are available on the repositories. Now, let's create a very, very small PHP page, a webpage, which will allow us a complete view of our current PHP set up from a browser. So we'll first change directory to var/www.html, which is where our web pages are stored. LS to list all the contents of this directory. And you'll see only so far we have index.html, which is the default page that someone would reach if he directed his browser to our IP address. Let's create a new page using nano, which is the text editing program, and we will call it info.php. We'll embed some PHP code and very, very briefly, the word PHP info, followed by the closing bracket, control X, Y for yes, and we have saved this new file. To make sure that it's going to run the way we expect it to, let us restart Apache2. And then, we'll head to our browser to take a look. We'll enter the IP address of our Amazon instance, followed by / and info.php, which is the name of the file we've just created. Hit enter, and PHP presents us with a profile of what we have on our system, the extensions that exist so far, and the basic configuration, based on Apache2, which is the platform we're using, of PHP, the way it currently exists. Obviously, this contains a great deal of information that could be very important in setting up the type of web service that you're after. Let's now install a PHP utility called PHP my admin, which allows you to configure and manage your PHP installation from a web browser, anywhere in the internet. Let's first type pseudo apt get update to again, update our record of the online repositories. Once that's done, we'll type pseudo app get install php my admin. We are asked to configure the database. I'll type yes or enter for yes. I'll enter a database administrative user password and an application password, and confirm that.

Now, we have to choose which framework we want to run our PHP my admin under. We use the space key to toggle on or toggle off one of our selections. You could use the arrow keys to go up and down, in this case, Apache 2 and Light TPD. We're going to toggle Apache on, hit the tab key to highlight the okay, and enter to go ahead.

And we seem to be properly installed. Let's go to a browser to see if we can now access the PHP my admin interface from the web. I've entered the IP address of our Amazon instance and PHP my admin, and I'll hit enter. And in fact, we've reached the login window for PHP my admin.

About the Author
David Clinton
Linux SysAdmin
Learning Paths

David taught high school for twenty years, worked as a Linux system administrator for five years, and has been writing since he could hold a crayon between his fingers. His childhood bedroom wall has since been repainted.

Having worked directly with all kinds of technology, David derives great pleasure from completing projects that draw on as many tools from his toolkit as possible.

Besides being a Linux system administrator with a strong focus on virtualization and security tools, David writes technical documentation and user guides, and creates technology training videos.

His favorite technology tool is the one that should be just about ready for release tomorrow. Or Thursday.