Web Hosting Forum | Lunarpages

Author Topic: PHP Include  (Read 6396 times)

Offline adez

  • Newbie
  • *
  • Posts: 1
PHP Include
« on: July 16, 2009, 12:46:00 PM »
Hi,

My website was just upgraded from the basic shared enivorment to Linux VPS. For some reason, PHP include is not working. Example:

<html>
<body>
<?php echo date('l jS \of F Y h:i:s A'); ?>
<h1>Welcome</h1>
<?php include("header.php"); ?>
<h1>Bye</h1>
</body>
</html>

When I go to http://74.50..../phptest.html all I see is

Welcome
Bye

What do I need to do to get this to work?

Thanks,
adez

Offline perestrelka

  • Master Jedi
  • *****
  • Posts: 1397
Re: PHP Include
« Reply #1 on: August 13, 2009, 02:31:18 AM »
Hello Adez,

Sorry, maybe I'm late, but if you have not solved this issue, what does Apache error log say when you try to access the test page. The log path is var/log/httpd/error.log and it is available for the root via SSH. If you have solved this problem, it would be very nice, if you put the solution here for others who may run into this.
Kind Regards,
Vlad Artamonov

Offline lexhair

  • Galactic Royalty
  • *****
  • Posts: 427
Re: PHP Include
« Reply #2 on: August 13, 2009, 07:52:27 AM »
Hi,

My website was just upgraded from the basic shared enivorment to Linux VPS. For some reason, PHP include is not working. Example:

<html>
<body>
<?php echo date('l jS \of F Y h:i:s A'); ?>
<h1>Welcome</h1>
<?php include("header.php"); ?>
<h1>Bye</h1>
</body>
</html>

When I go to http://74.50..../phptest.html all I see is

Welcome
Bye

What do I need to do to get this to work?

Thanks,
adez

Include needs an absolute path to the file, not a relative path.

Since your dedicated, I'm not sure what the correct absolute path is.

Offline wektech

  • Master Jedi
  • *****
  • Posts: 1037
    • Yuma Arizona Information
Re: PHP Include
« Reply #3 on: August 13, 2009, 09:44:32 AM »
Perhaps this is simplistic but I noticed the commands are in file using a html extension. Have you informed the server that it needs to parse html files for php content.

 

Share |