dongtan6695 2013-04-07 02:02
浏览 61
已采纳

Apache不会解析php页面

So I've installed LAMP on an Ubuntu machine for some php development and everything is working fine except instead of parsing and displaying php pages, the browser is asking me if I want to download them. I know this is a well documented issue, and I've already been to the Ubuntu page concerning it, and gone through all the potential causes. I've installed libapache2-mod-php5 and upon running sudo a2enmod php5 I get module php5 already enabled. So I think I've pretty much narrowed the problem down to a php file authorizations issue.

Now I should point out that this only happened after I modified the config file to allow a UserDir in my /home/public_html. With the default configuration in folder /var/www php files parsed just fine, and still do, so long as I gave myself root access or modify their permisssions. And I didn't change anything else in the config file.

So, my question is, how do I check/modify the php authorization files? Where are they? What exactly do I check? I can't seem to find any good info on this.

  • 写回答

4条回答 默认 最新

  • duangai1368 2013-04-07 03:08
    关注

    So I figured this out with some really tedious searching, I'm surprised the solution is not more widely available, it's really very simple. The /etc/apache2/mods-available/php5.conf file comes with these lines.....

     8     # To re-enable php in user directories comment the following lines
      9     # (from <IfModule ...> to </IfModule>.) Do NOT set it to On as it
     10     # prevents .htaccess files from disabling it.
     11     <IfModule mod_userdir.c>
     12         <Directory /home/*/public_html>
     13             php_admin_value engine Off
     14         </Directory>
     15     </IfModule>
    

    ...which obviously disable php in user directories. These need to be commented out.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥15 matlab中使用gurobi时报错
  • ¥15 WPF 大屏看板表格背景图片设置
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂