Forum Moderators: coopster

Message Too Old, No Replies

Need help with a basic php command

         

Barb

6:44 pm on Feb 5, 2008 (gmt 0)

10+ Year Member



We moved a website from a shared server, cPanel platform to a dedicated server, Plesk platform, and it's my first time using Plesk. I am not the admin of the dedicated server.

In the website, the only PHP we use is the include command to pull in the header.html, footer.html, and navigation.html files.

The root pages of the site has the command as:
<?php include('navigation.html')?>

For those pages that were behind a folder (ie., /articles/index.html), the command had to be:
<?php include('/home/heavensa/public_html/header.html')?>

Now ... on the dedicated server, the root pages of the site are still fine ... but those pages behind folders doesn't recognize any version of the command to pull in the header, footer, and navigation.

I have tried the full path to the file and other variations. Nothing works. There is no permissions issue according to Support for the server.

I'm still learning PHP, so please explain plainly *grins* I did install and modify my own Oscommerce cart with no knowledge of php or sql ... but can't write my own code by any means.

Thanks in advance for any suggestions you can offer.

Barbara

jatar_k

6:58 pm on Feb 5, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



are you getting error messages when you try and include it?

my gut says it's just the path since you can include at the root level

since your root include looks ike this
<?php include('navigation.html')?>

you could try something like this

<?php include $_SERVER['DOCUMENT_ROOT'] . 'navigation.html';?>

Barb

7:01 pm on Feb 5, 2008 (gmt 0)

10+ Year Member



No error messages .... no red x's ... nada ... just the main content of the page(s) as if that was all there was in the source code.

I'll try your suggestion ....

Barb

7:03 pm on Feb 5, 2008 (gmt 0)

10+ Year Member



Nope, that didn't work either.

I'm at a loss.

jatar_k

7:07 pm on Feb 5, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



you could try changing your error reporting at the top of your script

error_reporting(E_ALL);

see if that shows the error.

another thing for error reporting is there is a setting in php.ini display_errors [php.net] which may be turned off

another question for clarity

do these files, in the root and other, all end in php?

Barb

7:14 pm on Feb 5, 2008 (gmt 0)

10+ Year Member



no, they do not end in .html ... never have.

Everything has worked fine for the longest of time on the shared server (PHP5) ... same PHP on the dedicated server and now the code doesn't work.

jatar_k

7:16 pm on Feb 5, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



though just because the version is the same it doesn't mean it is configured exactly the same

plus paths change when you change servers so things like includes always break, especially when you use absolute paths like that

Barb

7:21 pm on Feb 5, 2008 (gmt 0)

10+ Year Member



I mentioned this to the support tech for the server, and he mentioned that it looks like a path issue and that he would have to charge hourly for a programming problem ... just need him to mention what it is and I'LL DO the programming of my website pages. GEESH!

When my other hosting company upgraded to PHP5, they told me the new path to use on those pages within folders ... that is all I needed ... I re-did the pages accordingly.

Something so easy ... why does everyone have to make it so complicated? grrrr. hehehe

Barb

7:31 pm on Feb 5, 2008 (gmt 0)

10+ Year Member



Is there any website that lists of all possible variations of the include command?

The documentation and help files in the php main site is all gibberish to me.

jatar_k

7:34 pm on Feb 5, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



well, you could add this to a file in your root

echo __FILE__;

that will give you the full path and then you can just change the filename

or you could use this

echo '<pre>';
print_r($_SERVER);
echo '</pre>';

and look at DOCUMENT_ROOT or PATH_TRANSLATED

Barb

7:36 pm on Feb 5, 2008 (gmt 0)

10+ Year Member



I'm sorry - can you explain that in more detail?

Add that to what file in root?

And where do I add the echo statement?

jatar_k

7:40 pm on Feb 5, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



I am assuming your header, footer and navigation are located in your root since your root file include has no path, just a file name

you could add either of the echo's to one of those files and call it directly in your browser, this should output the path