doushenjia8514 2013-04-11 14:08
浏览 18
已采纳

不在public_html中执行的帧的php代码

I have a php site main.php in the public_html dir, which sources several frames:

<html>
<head>
<title>My Site</title>
</head>
<frameset rows="55, *, 0" frameborder="no">
    <frame id='headerFrame' src="headerFrame.php" scrolling="no">
    <frame src="mainPages/a.php">
    <frame src="mainPages/b.php">
</frameset>
</html>

The php code tags in main.php (not shown) are executed correctly by the server, but when I review the frame sources in the browser, I see uninterpreted php tags in the html:

headerFrame.php:

<?php
include 'base.php';
?>
<html>
...

How comes that main.php is interpreted, but headerFrame.php not? When I move the page to /var/www/mypage/ this works out all well.

Environment: Ubuntu 12.10, apache2

  • 写回答

1条回答 默认 最新

  • douqinlu4217 2013-04-19 12:12
    关注

    I found the error on my own, which is not completely evident in the posted snippet:

    There where many includes with relative paths in the php scripts. And relative paths for include are handled differently for /var/www/mypage and ~/public_html/mypage.

    The former one considers relative paths relative to the running script file location, whereas the latter one handles relative paths relative to the main dir (~/public_html/mypage).

    As in the latter case the included php files where not found, the php tags where dumped instead of interpreted by the apache server.

    I use the default apache2 configuration for Ubuntu 12.10, except that I enabled the userdir.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料