Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am kind of trying to transfer my website to an Amazon EC2 instance. I have set up everything and now when I open my website instead of seeing the website I just get to see the source code.

Is there anything I did wrong in the setup process ?

share|improve this question

migrated from Mar 15 '13 at 10:38

This question came from our site for pro webmasters.

have you installed php? – Sumit Bijvani Mar 15 '13 at 8:23
No I haven't. How do I do that ? – Martin E. Mar 15 '13 at 8:28
read my answer, it will help to configure whole server and PHP, MySQL too – Sumit Bijvani Mar 15 '13 at 8:31
up vote 2 down vote accepted

If you want to run php of Amazon EC2, you must have to follow this steps

Configuring PHP

First, the basics for PHP:

sudo yum install php-mysql php php-xml php-mcrypt php-mbstring php-cli mysql httpd

Press y for each of the prompts that shows up. Note that you’re logged in as ec2-user, so you need to sudo all of these commands.

You should now be able to create and run a PHP test file. Next, let’s get MySQL up and running.

Want more details read this article : Getting PHP and MySQL running on Amazon

share|improve this answer
very nice thanks very much ! I now have a web server running and installed php and mysql, but where do I upload my files, or more specifically, how do I do that ? I guess into the var/www/html folder, is that correct ? – Martin E. Mar 15 '13 at 9:18
great! yah you can upload it in var/www/html or create new folder inside ec2-user folder like public_html – Sumit Bijvani Mar 15 '13 at 9:24
you can upload it in any directory but make sure you must have to specify path in httpd.conf file – Sumit Bijvani Mar 15 '13 at 9:26
Brilliant thank you very much Sumit ! One more thing: If I wanted to add files to the folder via a ftp client how would I do that ? – Martin E. Mar 15 '13 at 9:30
you can't access you ftp but you can do it via sftp. – Sumit Bijvani Mar 15 '13 at 9:32

You can't run PHP code from S3 at all -- it's just a storage service and a web server, it doesn't include a PHP application server. As the other answer states, you can set up an instance in EC2 and run a web application there, but EC2 and S3 are two different services.

share|improve this answer
Thank you, I was not quite sure how these two services work together. Now I know they don't. Useful ! Thanks – the_critic Mar 16 '13 at 1:30

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.