Deploying Codeigniter App on Amazon AWS - php

I recently enrolled to basic version of Amazon AWS. I was able to create a new instance and get it running state in the console. Can anyone please guide how to upload a sample php file and redirect to GoDaddy domain.
Read a lot of their online help but couldn't figure out the procedure.

Please follow the following steps. This is for Ubuntu 14.04
Setup an Web server with database and PHP
Refer: https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu-14-04
Install PhpMyAdmin for setting up database
Refer: https://www.digitalocean.com/community/tutorials/how-to-install-and-secure-phpmyadmin-on-ubuntu-14-04
Upload your database through PhpMyAdmin dashboard.
Connect to sever using SFTP clients like FileZilla or WinSCP.
Goto your webroot directory (By default /var/www/html) and upload the code.
Change the database username, password & database name in the database configuration file of your app code.
Login to Godaddy domain section and create an A record for the domain and set value as the public ip of your AWS Instance.
It will take some time to reflect in DNS. Meanwhile you can test the working of application by going to the public ip of AWS Instance.

Related

How to upload a PHP file on Azure

Right now I have a localhost database using WAMP server.
I connect and insert data to this DB by making a POST request to the file's PHP link (e.g localhost/sensor_data/connect_To_DB_And_Insert_Data.php).
I want to do the exact same thing with Azure SQL so my database won't be local anymore but on a remote server.
I have already created a database but I don't know how to upload a PHP file that can be accessed online using a link. There are so many documentations that I'm kind of lost and I didn't find an answer to this yet.
So my question is, how do I upload a PHP file on Azure, that it can be accessed by a link, so I can insert data to the database by making a post request to that link ?
Firstly, you just need to change the connection string in your PHP code. Then your PHP application will be able to connect to Azure SQL. In this way, you do not need to create any Azure host server (Web app or VM).
You can get the connection string on Azure portal:
Attention, as Azure SQL has enabled firewall. So, if you want to connect to it from your local server, you need to add your IP to the allowed IP list
However, as #UkraineInTheMembrane suggested in the comment, you can also to use Azure Web App or VM to host your PHP application.
With Azure Web App, here is a get-started tutorial for PHP: Create a PHP web app in Azure , in this tutorial, git is used to manage your code.
There are also many other approaches to upload your code to azure web app: https://learn.microsoft.com/en-us/azure/app-service/deploy-zip

How to publish a website built by HTML and PHP?

I built a website (localhost) using PHP and HTML through XAMPP. Now, I want to publish it online (webhost), available to everyone. What should I do? Thanks in advance!
First you need a host to upload your files. For this purchase hosting space from godaddy, bluehost or someother provider. You need to purchase a domain too. After domain and hosting space, if you have purchase linux hosting, then 90% chance is that you will get a cpanel. So log into your cpanel then navigate to 'public_html'. Inside this, using some ftp client like filezilla, or cpanel's build in upload feature, upload all your files. If your website needs a database, then you need to create a database, add database user and password using database wizard tools in cpanel.
When you will purchase a hosting, these things will be very clear once you login and expore a little.
Moving a website to another host consists of the following steps:
Moving the website's files.
Moving the website's database(s) (if any).
Configuring your application to work at the new host.
Pointing your domain's DNS to the new host.
A more detailed breakdown of these steps can be found below:
Transferring the files to the new host
The most convenient way to transfer your website's files to your new web hosting account is via FTP. You should connect to your hosting account and download the files locally to your computer. Then you have to upload them to your new hosting account's main folder (usually public_html, www or httpdocs).
More information on how to use FTP can be found in our FTP tutorial.
Transferring the website's databases
You have to export the database content from your old hosting account (usually into an SQL file), create a new database at your new hosting company and import the information in it. For detailed information on how to import/export databases via phpMyAdmin you can refer to this tutorial.
Application setup on the new host
This really depends from the website application that you are using. For step-by-step instructions on how to reconfigure some of the most popular applications
Check this out https://www.heroku.com/. The website will update as you push your code to the git. It's free, easy to use and good for small project.

Deploying application in elastic beanstalk AWS

I created multiple REST api's for my website on a local server(wamp) and now i am trying to move it to a online server(aws elastic beanstalk). My question is where do i build my database with the tables and rows etc just like in phpmyadmin? I figured that "upload and deploy" means upload the php file i made but when i do i get an error saying "health degraded". So what i want to do is basically move my local server to an online one with aws EB. I watched a bunch of videos and did a lot of research but can't seem to find the way to go about this problem.
My question is where do i build my database with the tables and rows
etc just like in phpmyadmin?
You can connect to the RDS instance created by beanstalk using a Database Management Client Tool like MySQL Workbench, Heidi SQL & etc using the DNS name, created for RDS instance. However one challenge you will face is to access the RDS instance from your client machine, since its not a good practice to make the Database publicly accessible. You can create a EC2 instance (Windows or Linux with GUI) inside the same VPC, connect to it (Remote Desktop or SSH) and install the tools so that you can use the tools inside the server, to connect to the RDS instance.
I figured that "upload and deploy" means upload the php file i made
but when i do i get an error saying "health degraded"
To understand the structure in code inside the Zip file, I would recommend to create a Beanstalk environment with a sample project available in Beanstalk and download the sample project artifact (Zip file) from S3 so that you can compare the project structure requirements.
If you prefer to go through the documentation, you can refer this. If nothing goes well, connect to the ElasticBeanstalk provisioned EC2 instance (Either using Remote Desktop for Windows or SSH to linux) and investigate the deployed artifacts.

Can't ftp to azure webapp

I've created simple webapp + mysql database on azure and i've set ftp username/pass. I'm following this article:
https://azure.microsoft.com/en-us/documentation/articles/web-sites-php-mysql-deploy-use-ftp/
Everything is fine up to the ftp part, i just can't connect to that ftp. I tried using the username/pass i set in Deployment Credentials. I tried using the username/pass i see in the PublishSettings file, but nothing is working.
I tried via linux ftp cmd and filezila and played with active/passive.
When i telnet ip 21 i'm getting timeout too.
Could someone please explain how to connect to that azure ftp?
Thanks
One common problem is that you need to have the username look like YourSiteName\YourUserName and not just YourUserName.
If you look under 'FTP/Deployment username' in the Azure portal, it gives the correct name with the site name prefix.
According to the offical documents, the section Deploy by copying files to Azure manually of the doc Deploy your app to Azure App Service introduce the steps of deploying the WebApp via FTP.
The key point of deploying via FTP on Azure is the FTP connection information, you can follow the steps 5 to 7 of the section Get MySQL and FTP connection information of the doc Create a PHP-MySQL web app in Azure App Service and deploy using FTP to find them from the .publishsettings file got on the Azure new portal, please see the picture below.
The method shown in the tutorial you link to is how I do it when I need to lookup my azure credentials - by downloading the Publish Profile and pulling the information out of there.
Here's how I do it:
using FileZilla (https://filezilla-project.org/) I plug the publishurl in the host field, leave the port blank, select FTP - File Transfer Protocol, use explicit FTP over TLS if available, Logon Type: Normal, enter userName in the user field, userPWD in the password field.
Click Connect and the FTP connection is made (after I click the security msg).
So it's a plain old FTP connection. There's nothing special going on.
If this isn't working for you I would suggest the problem isn't with your credentials, check the webapp has been started in azure, check you can ftp with another site\server.
Good luck. Hope this helps.

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,

Categories