Amazon EC2 Webserver not running PHP

Associate
Joined
16 Aug 2003
Posts
221
I have setup an Amazon EC2 instance for a webserver using the Amazon Linux AMI which I think is based on CentOS.

I cannot seem to get php to run in any of the webserver subdirectories. All I get rendered in the web browser is the php contents.

php runs ok in /var/www/html/ but no sub directories under it.

I have set mod_rewrite (.htaccess) work in subdirectories by editing /etc/httpd/conf/httpd.conf and replacing AllowOverride None with AllowOverride All under <Directory "/var/www/html">

What am I doing wrong?
 
Soldato
Joined
8 May 2011
Posts
4,939
Location
HQ
What else is in your user.conf?
Code:
<Directory "/var/www/html">
Options FollowSymLinks Indexes MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
 
Associate
OP
Joined
16 Aug 2003
Posts
221
The <Directory "/var/www/html"> part of /etc/httpd/conf/httpd.conf looks like below:

Code:
<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

#
# Controls who can get stuff from this server.
#
    Order allow,deny
    Allow from all

</Directory>
 
Soldato
Joined
8 May 2011
Posts
4,939
Location
HQ
I'm going to assume you've tried my suggestion?

You also need to restart httpd after you make any changes. If you still have problems. I would double check all your config files. Make sure you have the php MIME type and then look for any possible character encoding problems (utf-8).
 

fez

fez

Soldato
Joined
22 Aug 2008
Posts
20,167
Location
Tunbridge Wells
Most web servers will have multiple conf files that are loaded along side httpd.conf or apache2.conf etc. Quite often there is a folder for user specific config files for each user to define their own rules.
 
Top Bottom