0

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

4

1 回答 1

0

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.

于 2013-04-19T12:12:48.297 回答