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

2
  • Your path for your include is probably wrong. Error reporting would tell you this.
    – John Conde
    Apr 11, 2013 at 14:11
  • Do you have /var/www and /var/public_html? Or how does your directory structure look like? There might be an issue with your php configuration, saying that php is executed in /var/www but not in /var/public_html
    – strauberry
    Apr 11, 2013 at 14:27

1 Answer 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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.