spider Posted January 26, 2010 Share Posted January 26, 2010 Hi y'all! I've recently installed Apache server 2.2, PHP 5.2x. Apache installed alright (It works! in the browser window), PHP too (127.0.0.1 returned the PHP intro page with descriptions and everything). I tried to test them and introduced a simple line into an html code,<html><head><title>PHPTest</title></head><body><?php $salutation = "Hello, World!"; echo "<p> $salutation </p>";?></body></html>and opened the file (test.php) in my browser. But it returned the following textЗдравствуй, мир!Anyone any idea? Thanks in advance! Link to comment Share on other sites More sharing options...
justsomeguy Posted January 26, 2010 Share Posted January 26, 2010 What do you see if you view the HTML source of that page? Link to comment Share on other sites More sharing options...
spider Posted January 26, 2010 Author Share Posted January 26, 2010 What do you see if you view the HTML source of that page?if you mean when I use<p>Hello, World!</p>instead of <?php..........?> in the code above, then it's Hello, World! in the upper left corner of the browser window... Link to comment Share on other sites More sharing options...
justsomeguy Posted January 26, 2010 Share Posted January 26, 2010 I mean if you open the PHP page in the browser, and then go to View->Source, what's there? Link to comment Share on other sites More sharing options...
spider Posted January 26, 2010 Author Share Posted January 26, 2010 I mean if you open the PHP page in the browser, and then go to View->Source, what's there?The source breaks down like this<html><head><title>Страница сценария с переменной</title></head><body><p> Здравствуй, мир! </p></body></html> Link to comment Share on other sites More sharing options...
justsomeguy Posted January 26, 2010 Share Posted January 26, 2010 Yeah, that's weird. Would there be some sort of output module for Apache which is rewriting the pages? It transforms the title text and the paragraph text but doesn't do anything to the HTML tags - that sounds like a program being run on the output. Link to comment Share on other sites More sharing options...
spider Posted January 26, 2010 Author Share Posted January 26, 2010 Yeah, that's weird. Would there be some sort of output module for Apache which is rewriting the pages? It transforms the title text and the paragraph text but doesn't do anything to the HTML tags - that sounds like a program being run on the output.Beats me... Guess I'll have to dig into it and find the bug. Anyways, thanks. Link to comment Share on other sites More sharing options...
boen_robot Posted January 27, 2010 Share Posted January 27, 2010 Looks like your PHP file is UTF-8 encoded... good for you!Now, the problem is making sure PHP outputs UTF-8 encoded HTML too. You can do that by adding an appropriate HTTP header, like so: <?php header('Content-Type: text/html;charset=UTF-8'); ?><html><head><title>PHPTest</title></head><body><?php$salutation = "Hello, World!";echo "<p> $salutation </p>";?></body></html> Make sure there is NOTHING before this first "<?php". Not even a whitespace! Otherwise, you'll get a "... headers already sent ..." error. Link to comment Share on other sites More sharing options...
justsomeguy Posted January 27, 2010 Share Posted January 27, 2010 If that were the case, wouldn't it transform the HTML tags also? Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.