Closed Thread Icon

Preserved Topic: php not outputted right Pages that link to <a href="https://ozoneasylum.com/backlink?for=20988" title="Pages that link to Preserved Topic: php not outputted right" rel="nofollow" >Preserved Topic: php not outputted right\

 
Author Thread
riddim
Nervous Wreck (II) Inmate

From:
Insane since: Aug 2000

posted posted 06-19-2001 12:09

I just installed php & apache on Windows but the simple code below saved as .php outputs text code instead of generating the proper html page. I've checked to make sure its outputting text/html and not just text but the error is still the same.
<?php
print("Hello world!");
?>

$> php hello.php
Content-type: text/html

Hello world!
$>


but all other regular .html pages and a .php page with <? phpinfo(); ?> in it displays OK.
What could I be doing wrong? Do I need to change any settings in th php.ini file?

mr.maX
Maniac (V) Mad Scientist

From: Belgrade, Serbia
Insane since: Sep 2000

posted posted 06-19-2001 12:23

If I understand you correctly, by proper html page, you mean the <html><head></head><body></body></html> parts, right? If so, you have to add them by yourself, like this:

<html>
<head>
<title>Test</title>
</head>

<body>

<?php
echo "Hello world!";
?>

</body>
</html>

linear
Paranoid (IV) Inmate

From: other places
Insane since: Mar 2001

posted posted 06-19-2001 20:58

That's true. PHP will add the MIME-type header for you magically, but that's all.

« BackwardsOnwards »

Show Forum Drop Down Menu