Web Hosting on Amazon AWS (PHP + MySQL)

0 votes

I am totally confused on how to host a Dynamic website created using PHP and MySQL in Amazon Cloud.

I went through Amazon S3 and I hosted a static website there!

Then I tried Amazon EC2 and I learned some aspects about the concept of VPC. I thought that the dynamic websites are hosting in Amazon Cloud using EC2. I followed some steps and they taught me how to launch a website using Drupal (But, I didn't want that !! )

No other tutorials on EC2 to deploy my web application was not found.

Then I found AWS Elastic Beanstalk, I uploaded a simple PHP document and I can see that deployed successfully.

But Still, I am not satisfied. Because, I don't know which is the correct way to deploy my PHP application.

So can anyone direct me on Deploying a PHP MySQL Application in AWS ?

Dec 28, 2018 in AWS by Sushmita
• 6,820 points
86 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

You can do this using AWS RDS

Follow these steps

  • Search for RDS in console, Select MySQL engine, enter the details (DB name, User, Password) and keep the rest categories as default.
  • Mention retention period of 1-7 days, and launch the instance.
  • After launching change the inbound security to "Any where".
  • Copy the endpoint url and port number.
  • Install wamp server 64 and mention its path in command prompt.
  • To connect to your database enter the following credentials- endpoint, port, user name and password: To connect to your database enter the following credentials- endpoint, port, user name and password

  • To see all the databases available enter following command: show databases;(you can run all your SQL Commands)
  • Go to wamp64 and create a folder www.directory, Install AWS SDK for PHP (  https://amzn.to/2LNUuxd ) and visual studio code
  • create  program file in Visual Studio-
  • mention these configuration lines in your php code

{

$servername = "mydbinstance.cg0pjwazvghg.us-west-1.rds.amazonaws.com";

$username = "admin";

$password = "edureka123";

$dbname = "edureka24db";

$usertable= "sample";

$fname = $_POST['firstname'];

$lname=$_POST['lastname'];

// Create connection

$conn=mysqli_connect($servername,$username, $password) OR DIE ('Unable to connect to database! Please try again later.');

echo "<p>Connected to MySQL!</p>";

mysqli_select_db($conn,$dbname);

echo "<p>Connected to DB!</p>";

// Check connection

$sql = "INSERT INTO ".$usertable." values('".$fname."','".$lname."');";

  • To debug the code click on “Start Debugging”

 

 

answered Dec 28, 2018 by ArchanaNagur
• 1,070 points

Related Questions In AWS

0 votes
1 answer

Web Hosting on Amazon AWS (PHP + MySQL)

You can simply refer the following link, ...READ MORE

answered Aug 7, 2018 in AWS by Priyaj
• 56,120 points
38 views
0 votes
1 answer

How do you pass custom environment variable on Amazon Elastic Beanstalk (AWS EBS)?

Old way  - use .ebextensions/*.config in AWS ...READ MORE

answered Sep 11, 2018 in AWS by Archana
• 3,770 points
33 views
0 votes
1 answer

How PCF (Pivotal Cloud Foundry) is different from AWS (Amazon Web Services)

PCF is a commercial cloud platform (product) ...READ MORE

answered Sep 11, 2018 in AWS by Priyaj
• 56,120 points
148 views
+1 vote
2 answers

How do I run python script on aws EC2 instance(ubuntu)?

I believe that you are using the ...READ MORE

answered Apr 17, 2018 in AWS by Cloud gunner
• 4,240 points
1,363 views
0 votes
1 answer
0 votes
1 answer

How do I create folder under an Amazon S3 bucket through PHP API?

Of Course, it is possible to create ...READ MORE

answered Apr 24, 2018 in AWS by anonymous
1,561 views
+1 vote
3 answers

Unable to login to parse dashboard on AWS

I had the same issue, which I ...READ MORE

answered Aug 28, 2018 in AWS by eatcodesleeprepeat
• 4,670 points
381 views
0 votes
1 answer

AWS EFS vs EBS vs S3 (differences & when to use?)

Parameters S3 EBS EFS Access Can be accessed publicly  Accessed only through given ...READ MORE

answered Aug 8, 2018 in AWS by ArchanaNagur
• 1,070 points
100 views
0 votes
1 answer

Does it make sense to have an Amazon Elastic Load Balancer with just one EC2 instance?

Well you are right Elastic Load Balancer ...READ MORE

answered Mar 20 in AWS by ArchanaNagur
• 1,070 points
20 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.