Forum Moderators: coopster

Message Too Old, No Replies

PHP Error.

         

wfernley

2:34 pm on Jan 28, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I seem to be having a problem with one of my php scripts. I have made it on my pc using IIS and the latest version of PHP. I get the problem when I upload to 4.0 PHP on an Apache Server.

Basically I get a problem when using an include like this:

include("<?=$CFG->wwwroot?>/index.php");

I also have a problem when using <?=$CFG->wwwroot?> as a link. When in the browser the link displayes the <?=$CFG->wwwroot?> instead of what the variable is, which is my root folder.

Can anyone shed any light on this?

Thanks :)

rrdega

3:00 pm on Jan 28, 2004 (gmt 0)

10+ Year Member



This is a php file; Correct? Then you should be able to do this: <?php include("$DOCUMENT_ROOT/index.php");?>

wfernley

3:05 pm on Jan 28, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yeah I can, which would solve that problem. But I have many other variables that are similar to <?=$CFG->wwwroot?> that are variables for other directories. (ex. images, includes, libraries, etc) is there something about that variable perhaps the earlier version of PHP doesn't like?

rrdega

3:30 pm on Jan 28, 2004 (gmt 0)

10+ Year Member



Well, I am by no means an expert... I replied to your post when I was checking to see if anyone had responded to my own inquiry...

But, in your original post you had: include("<?=$CFG->wwwroot?>/index.php");

Question: At the point where you have this line in your code, you are already "in" PHP; Right? So why do you have the <?= and?> tags again? Have you tried simply removing those?

wfernley

3:41 pm on Jan 28, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks rrdega for your posts.

I have tried removing the <?= &?>. It does the exact same thing.

I am also not an expert, I wouldn't even call myself a novice. :) But this is how you learn. :)

Thanks.

Wes

WibbleWobble

4:23 pm on Jan 28, 2004 (gmt 0)

10+ Year Member



Hass the variable (or object variable, whatever) actually got anything assigned to it? Presumably so, because echoing it without having assigned it to anything (on my machine) just creates an empty echo. You could possibly try making another variable that calls that one, like:
$foo = $bar->bar2; 
include($foo /foobar.php);

and hope that does the trick.

I'm more than a little baffled by the open and close tags in it, too.

ps:
What is the error you get -- is it a parse problem, or an empty vaeriable, or something else?

wfernley

4:36 pm on Jan 28, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I do have something assigned to the variable.

It doesnt display an actual error. For example in the include - when displayed in my browser it will show the variable and not what I assigned to the variable. Also when using that variable, when its doing something either than an include it will show the php text in my browser.

I am using a tutorial called mymarket to do my site.

Thanks. :)

rrdega

4:42 pm on Jan 28, 2004 (gmt 0)

10+ Year Member



Ummm... Are you sure your web host supports php?

Do this, create/upload a file called phpinfo.php. Within it put this one line: <?php echo phpInfo();?>

Then load that page... You should see all of your PHP Settings, etc... If you see the php code itself, then your the web server is not parsing php.

wfernley

4:53 pm on Jan 28, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



PHP is running on my friends server. Some of the includes work, just not the ones where it has that variable.