Deploying PHP application using AWS Elastic Beanstalk - php

I am very new to AWS. I am trying to deploy my php application to AWS. I created an environment and then uploaded and deployed all files (including .sql) in zip format. When I am trying to access my website using URL it doesn't show anything. When I tried viewing page source, it showed database connectivity error?
Any help would be appreciated.
Thank you.

For Database connection,
You need create a new environment either using RDS or on the instance.
You can set up RDS using Beanstalk.
Refer :http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_PHP.rds.html#create_deploy_PHP.rds.newDB
Still you will have much to manually configure to load your existing data to RDS or to the instance.
Hope it Helps.. :)

I had written a blog on a similar use case. I also have a screencast on the same. Can you follow this and see if this helps:
http://www.tothenew.com/blog/aws-elastic-beanstalk-php/
I have deployed a wordpress PHP website. Look what you need is a new RDS or an old RDS instance or Database on an EC2 server and have to give PHP app that endpoint and port.

Related

Using php with angular application hosted on AWS

I'm new to AWS. I created a DB and I am currently hosting the website right now. This is great!
The problem is that I don't know how to integrate my PHP files that I was using before the start of AWS.
My previous stack was: Angular, MyPHP, MySQL, Apache. Everything was running locally. So I was able to use the same IP for the database and to also run php files.
What I tried to do was upload the php files into the S3 bucket. This doesn't work. The website will only download the file and not execute.
So how would I implement the same fluid way of integrating PHP on AWS as I did on my local computer?
If you want to do this on AWS you will need an EC2 instance to run your dynamic queries to the database. S3 will only host static files or programming which works on the client-side (JavaScript).
If it is a basic website, you might want to consider LightSail
My suggestions would be,
use EC2 instead of using s3 for hosting the PHP website as you can have complete control over the server.
For setting up EC2 with PHP please follow the steps in the following article.
Setting up EC2(ubuntu instance) for php

How to setup EC2 as simple website with php support?

I'm an AWS newbie and I can't seem to find a good example. There are plenty of static website examples for S3, but my site needs to run a fairly simple PHP script which then means I need to be on EC2.
I used Elastic Beanstalk to create an EC2 instance and it added a simple PHP example, so when I go to the public DNS address in a browser, I see the example PHP script run. So far, so good.
But, where are those files and how to I access/modify them? They don't seem to be in the S3 bucket that Elastic Beanstalk created.
If I try to Connect to my EC2 instance, it says there's a problem with port 22 and a key pair is needed. Not sure what to do here.
So, how do I upload an html website to run on this instance and still get a PHP script to run?
Sorry if I have some of the terminology or methodology wrong.
Thank you.
But, where are those files and how to I access/modify them? They don't seem to be in the S3 bucket that Elastic Beanstalk created.
They probably are but in a ZIP package. You don't modify anything on the fly. You're supposed to modify your source code on a local machine, "bundle" it in a ZIP file and then either
Upload with AWS Console.
Upload it to S3, create an application version with AWS CLI and then deploy (also with AWS CLI).
Docs are here: https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_PHP_eb.html
It is possible to change your application by connecting to an EC2 instance, but your changes will be lost during redeployment, scaling etc.
If I try to Connect to my EC2 instance, it says there's a problem with port 22 and a key pair is needed. Not sure what to do here.
When you created your Elastic Beanstalk environment you were asked for 'EC2 key pair'. You should use that exact SSH key to connect to your instance. This step is optional, so it is possible that you skipped it and created an environment without a key. In this case there is no way to connect to your EC2 instance (almost). You'll have to upload an SSH key (EC2 dashboard -> NETWORK & SECURITY -> Key Pairs) and create a new environment.

Wordpress white screen when launching from AWS EC2 AMI

I've created an AWS EC2 instance with a Wordpress site running on it. The MySQL database is on Amazon RDS and everything works perfectly. I've created an image from the EC2 instance and a snapshot from the RDS instance and attempted to bring up the site using the new instances but I keep getting a blank white screen. I can connect to the new RDS instance using MySQL Workbench so it looks like it's running. I can open up a phpinfo.php page on the EC2 instance so it looks like the web server is running. I've modified the wp-config.php file to point to the new RDS instance and changed the DOMAIN_CURRENT_SITE to point to the new EC2 instance. Still getting a blank screen. Any other options I can try? I've set WP_DEBUG to true but I don't get any error messages. Any help would be greatly appreciated.
thanks.
In my experience White Screens are commonly database issues.
Ensure you're connecting correctly and that the WordPress database is correct.
At a guess of the most likely problem; your /wp-config.php should contain the correct database hostname instance-name.randomcode.amazon-region.rds.amazonaws.com as opposed to localhost. This is because if you're running an RDS instance for your database it's a different server and than your AWS instance. This means it's not on the AWS localhost.
For more info the AWS docs are usually somewhat helpful. You can find them here

Are there any steps on how to set up an Apache Multi-AZ Amazon RDS database instance and using S3?

I am trying to set up a Linux/Apache Drupal Website using a Multi-AZ Amazon RDS database instance found in this link:
https://aws.amazon.com/cloudformation/aws-cloudformation-templates/
So far, I have launched the Drupal "Highly Available Web Server with Multi-AZ Amazon RDS database instance and using S3 for storing file content" stack using the link below and it has created my two instances, a Load Balancer and a DB.
I have followed all the steps up until the "Installing and Configuring Drupal" section in the following link thinking that I would just have to run through all the steps for each instance and it would then allow me to view my website on a browser:
http://www.imamuseum.org/cc-mcn09.pdf
My conf file is set up in the ect/httpd/conf.d folder in its own file.
Does anyone have any experience on this?
Please let me know if you have any questions.
Thanks,

Web Service creation AWS

So I am trying out AWS (Amazon Web Services) and I figured out how to put my db and its information on their server however I am not sure as to where I will put my php web service which gives a JSON response. Is there a tutorial or can someone tell me how I can accomplish this?
Suppose you are going to use the LAMP stack. I would either install LAMP on your EC2 instance or find a community image that has LAMP already installed and create an instance using that image.
You can start with Amazon Lightsail which is a beginner friendly service to deploy applications.
Or you can put your Application in Elastic Beanstalk and use its build in RDS feature for your database.
Attached you see the documentation for deploying a PHP application.

Categories