Page 1 of 1

[Help] php codes can't be rendered well.

Posted: Thu Mar 11, 2004 6:14 pm
by river001
I am using linux+apache+php+mysql solution now(I've never used it before).

the problems are:

(1) If I use <?php .......?> style, it works.
But if I use <? ...... ?>, apache cannot interpret the codes, and only render all the codes directly into my browser.

(2) I've set the value of DocumentRoot in httpd.conf, but when I use the following codes to display the value of $DOCUMENTROOT, I can see nothing:

<?php print $DOCUMENTROOT; ?>

so the following codes don't work either:
<?php include ($DOCUMENTROOT."/files/header.inc"); ?>

I've tried a long time, anyone who can help me, I will appreciate it very much.

Thanks a million!

Re: [Help] php codes can't be rendered well.

Posted: Thu Mar 11, 2004 6:59 pm
by river001
toweter wrote: the name of the variable is 'DOCUMENT_ROOT',
if it not works try it with "$_SERVER['DOCUMENT_ROOT']"
Thank you so much!

The problem is I cannot change the codes, because the codes are already done by others, I am deploying the whole website.

Do you have some other way to make $DOCUMENTROOT work?

Posted: Thu Mar 11, 2004 7:11 pm
by Illusionist
are you saying you can't edit the script and/or the php.ini file??

Posted: Thu Mar 11, 2004 9:05 pm
by river001
Illusionist wrote:are you saying you can't edit the script and/or the php.ini file??
I cannot edit the script but I can edit php.ini.
Thanks, I'll turn on the "register_globals" to make $DOCUMENT_ROOT work.

Posted: Thu Mar 11, 2004 9:07 pm
by Illusionist
but if you can't edit the script, which i dont see why you can't, the script wont work anyways. Your variable isn't $DOCUMENT_ROOT, which it should be, its $DOCUMENTROOT and that wont work, at least i highly doubt that it will. And if the script is on your server then why can't u edit it??

Posted: Fri Mar 12, 2004 8:16 am
by river001
Illusionist wrote:And if the script is on your server then why can't u edit it??
Because I'm not allowed to edit the codes. The whole website is working on a server, now I want to deploy it on the other server.

I've solved the problem by following your way, thank you so much!