0

I am not exactly sure what is going on here, but I imagine there is a problem with permissions. I will try to describe the symptoms and hopefully someone will have a cure? I am trying to run my website on an EC2 instance. I installed lamp by following this guide: https://gist.github.com/aronwoost/1105007. The website uses php, mysql and javascript. I see that I am able to access the mysql database by running the query from a php file but there are plenty of things that don't work right:

  1. When I use "include 'databaseinfo.php';", it automatically prints the contents of the file instead of importing the variables so I can make more secure mysql queries.
  2. In the main index.html file, I have some php code and try to get it to echo some html to run, but instead the html is just echo'ed as text instead of actually getting run.

EDIT: The only modification I have done to httpd.conf is this section:

<Directory "/var/www/html">

#
# Possible values for the Options directive are "None", "All",
# or any combination of:
#   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important.  Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
    Options Indexes FollowSymLinks

#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
#   Options FileInfo AuthConfig Limit
#
    AllowOverride All
Stagleton
  • 1,060
  • 3
  • 11
  • 35
  • Are you sure you set up PHP correctly? It sounds like you haven't loaded the PHP module and added the appropriate handler to your `httpd.conf`. – tadman Feb 24 '14 at 20:11
  • I would recommend just starting over with a new Ubuntu instance. With Ubuntu Linux, you can just do the following for a LAMP stack: `$ sudo apt-get install tasksel` `$ sudo tasksel install lamp-server` – Tomanow Feb 24 '14 at 20:13
  • 1
    Does your databaseinfo.php file start with ` – datasage Feb 24 '14 at 21:00
  • No, it was just . That seemed to have worked. Thanks :) Now, it's just a matter of figuring out why I can't pass variables from ajax. But I guess that's a different question now. – Stagleton Feb 24 '14 at 21:06
  • 1
    @Stagleton Short tags `` are disabled by default. You can enable them in php.ini if you need to, but its a good practice to avoid using them. – datasage Feb 24 '14 at 22:02

1 Answers1

1

Sounds like a mimetype issue. You might add this to your .htaccess (or to your main apache conf):

 AddType application/x-httpd-php .php .html
Nate Fox
  • 2,443
  • 1
  • 21
  • 17
  • Hey, thanks. This fixed at the issue I was having with point #2. include still prints the file contents of databaseinfo.php as a string – Stagleton Feb 24 '14 at 20:42