Modifying Apache Source Document on AWS EC2 Not Working
I have a PHP file in this directory: /home/ec2-user/folder/file.php
and I am setting up a LAMP server.
What I have tried:
and. Change document root inside/etc/httpd/conf/httpd.conf
I changed DocumentRoot and Directory and I changed Override to All. Here are the changes I made:
#DocumentRoot "/var/www/html"
DocumentRoot "/home/ec2-user/folder"
#<Directory "/var/www/html">
<Directory "/home/ec2-user/folder">
#
# 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>
But if I call <publicDNS>/file.php
, I get that the requested url was not found on the server.
B. Create a file serveExternal.php
inside a folder /var/www/html
.
Content:
$fileName = $_GET['filename'];
echo $fileName; // shown correctly
$cwd = getcwd(); // get the current working directory
echo $cwd ; // prints the /var/www/html
chdir ("/home/ec2-user/folder/"); // Change directory to /home/bitnami/folder/
require_once($fileName); // include the required file
chdir ($cwd); // Change the directory to its original location
But then my PHP file is never called.
Any solutions?
+1
source to share