Web Hosting Forum | Lunarpages


*
Welcome, Guest. Please login or register.
Did you miss your activation email?



Login with username, password and session length
October 23, 2014, 06:34:37 AM

Pages: [1]   Go Down
  Print  
Author Topic: PHP Include  (Read 4037 times)
adez
Newbie
*
Offline Offline

Posts: 1


« 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
Logged
perestrelka
Administrator
Master Jedi
*****
Offline Offline

Posts: 1397



« 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.
Logged

Kind Regards,
Vlad Artamonov
lexhair
Galactic Royalty
*****
Offline Offline

Posts: 427


« 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.
Logged
wektech
Master Jedi
*****
Offline Offline

Posts: 1023



WWW
« 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.
Logged

Pages: [1]   Go Up
  Print  
 
Jump to: