0

I have encountered this problem while learning PHP. I checked Stackoverflow and google, but could not find an answer.

Here is my simple php:

<?php
echo "<html>" . "\n";
echo 'Hello' . "\n";
echo "</html>" . "\n";
?>

When I run this on Linux command line, it produced a result I wanted:

<html>
Hello
</html>

With this, I called this php from a browser on web, and expected to see

detect

in the browser. However, I got

" ."\n"; echo 'hello ' . "\n"; echo "" . "\n"; ?>

I tried in a few different browsers, they all produced the same result.

I am afraid that I have missed some PHP fundamentals to get this problem, haven't I?

user1693207
  • 119
  • 2
  • 10
  • you didn't execute the php code, and it went out as raw text, meaning your browser interpreted ` – Marc B Nov 16 '15 at 19:09
  • TO Marc B: thanks for explaining the issue. What confused me was that php script could be executed at the Linux command line, but failed at browsers. – user1693207 Nov 19 '15 at 13:47
  • To summarize my learning from this issue: in Linux environment, Php script can be executed from the Linux command line. However, it does not mean that php is available for the web server. I did confirm with my service provider that PHP is not supported by the web server in my environment. – user1693207 Nov 19 '15 at 13:49

0 Answers0