Forum Moderators: phranque

Message Too Old, No Replies

New user struggling

PHP file content not showing in browser window

         

martinstan

7:51 pm on Jan 29, 2006 (gmt 0)

10+ Year Member



Hi
I'm trying to get my set up here to work with php files and keep running into a few problems. I'm just trying a few test bits of code but although when I check the source code of the web page my content is there , I have a blank page in my browser window. for instance

<?php
$color = "001FFF";
$text = "this page was dynamically generated.";
?>

<html>

<font color="<?php print $color;?>">

<?php print $text;?></font>

</html>

Is there something wrong with my code?
Thanks
Martin

coopster

5:59 pm on Jan 30, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld, martinstan.

What shows up when you view the source of the html page? The rendered html, or the php script and all?

martinstan

8:07 am on Jan 31, 2006 (gmt 0)

10+ Year Member



Hi Coopster and thanks for your welcome. I'm struggling in webmaster world at the minute.
Here is the source code from the blank 'variables.php test page.
<?php
$color = "001FFF";
$text = "this page was dynamically generated.";
?>

<html>

<font color="<?php print $color;?>">

<?php print $text;?></font>

</html>

A basic html file works eg. index.php with <html>hello</html> works fine.

Just to give you some background, jdmorgan kindly helped me with a recent problem and I don't know if the two are related? link below...

[webmasterworld.com...]

Kind regards
Martin

coopster

1:03 pm on Jan 31, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



If this file is named 'variables.php' and you are trying to call it up in your browser and the source code comes out just like you show it there, then you still don't have your server configured correctly to parse PHP pages. *Parsing* a PHP page means that the server recognizes the file extension '.php' and understands that it needs to invoke the PHP engine and allow php to do it's job on that page before the Apache server can send the results back to the user's browser.

Along with understanding your server configuration (Apache) as jdMorgan recommends, you should also understand your PHP installation [php.net]. Yes, it does take some time to read, review and understand all these things but they are critical in web site operation. Best regards!