dongxing1965 2014-02-24 20:08
浏览 77
已采纳

使用PHP在AWS EC2实例上运行Apache2网站

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
  • 写回答

1条回答 默认 最新

  • douhao7677 2014-02-24 20:14
    关注

    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
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥50 power BI 从Mysql服务器导入数据,但连接进去后显示表无数据
  • ¥15 (关键词-阻抗匹配,HFSS,RFID标签)
  • ¥50 sft下载大文阻塞卡死
  • ¥15 机器人轨迹规划相关问题
  • ¥15 word样式右侧翻页键消失
  • ¥15 springboot+vue 集成keycloak sso到阿里云
  • ¥15 win7系统进入桌面过一秒后突然黑屏
  • ¥30 backtrader对于期货交易的现金和资产计算的问题
  • ¥15 求C# .net4.8小报表工具
  • ¥15 安装虚拟机时出现问题