I have this file x.php but it doesnt work. Php only works if it is in a pure php file
(with no html code).Im using xampp 1.7.7. Any ideas what might be the problem ?

<html>

<body>

<?php
echo ("HELLO");

?>
</body>

</html>

Works fine on my system: Fedora 15, Firefox 9, Apache 2.x on localhost. I think it should run on other systems too. What error do you get?. If you look at the page source in the browser is there anything displayed? What do you get if you add some text to the html code such as below?

<html>

<body>

<h1>Do you see HELLO WORLD or just WORLD?</h1>

<?php
echo ("HELLO");
?>

<span> WORLD</span>

</body>

</html>

What it shoes is <?echo ('hello')?> but i ve tried in another computer with windows vista and it works fine,(im using xp professional).

Works fine on my system: Fedora 15, Firefox 9, Apache 2.x on localhost. I think it should run on other systems too. What error do you get?. If you look at the page source in the browser is there anything displayed? What do you get if you add some text to the html code such as below?

<html>

<body>

<h1>Do you see HELLO WORLD or just WORLD?</h1>

<?php
echo ("HELLO");
?>llo

<span> WORLD</span>

</body>

</html>

Did you use PHP short tags (as it is displayed in your last post)? Maybe your web server is not configured for short tags. Also it might be a good idea to put a whitespace between the tags and PHP code.

i don't see something wrong with your code....what's the error?

<?php
phpinfo();
?>

What does it return ? Also, don't put the bracket with echo statement.

<?php
echo "Hello";
?>

It should be.

how are you accessing the file
it appears a localhost error

Thank you all. I solved the problem by saving the file in a php editor program.The file was formatted using wordpad.Plus i installed the windows 7.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.