Link to home
Start Free TrialLog in
Avatar of Torquil Beavis
Torquil BeavisFlag for Canada

asked on

AWS EC2 PHP code is not being executed code shows on the page instead

I'm installing the LAMP web server on Amazon Linux in Canada (Central). I exactly followed the instructions at http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/install-LAMP.html to install the Apache 2.4 server and PHP 5.6.

When I tested for phpinfo.php on the browser as suggested, only the php code showed instead of being executed. I tried with a simple php script to be sure there wasn't an error with phpinfo.php and the same happened.

It's as if Apache can't find the PHP files to interpret the script.

Any ideas as to what I should do?
ASKER CERTIFIED SOLUTION
Avatar of Abhijeet Rananaware
Abhijeet Rananaware
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Torquil Beavis

ASKER

I changed the file as you said. However, the file would not be overwritten ..
scp: /etc/httpd/conf/httpd.conf: Permission denied

When I tried to change permissions ..
Command 'chmod  0664 "httpd.conf"'
failed with return code 1 and error message
chmod: changing permissions of 'httpd.conf': Operation not permitted.

Any idea how to circumvent this?
Use sudo while editing httpd.conf for eg sudo vi /etc/httpd/conf/httpd.conf or sudo nano /etc/httpd/conf/httpd.conf and then save it.
Changed successfully as you recommended.
Still not working, when I entered http://public dns/phpinfo.php ..

The public dns page isn’t working

public dns didn’t send any data.
ERR_EMPTY_RESPONSE
When I restarted the instance via sudo then re-tested phpinfo.php on the browser ..

Not found
The requested URL /phpinfo.com was not found on this server
is phpinfo file located in correct directory ??
is phpinfo file located in correct directory ??
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial