简体   繁体   English

PHP5文件在apache2中提供html输出

[英]PHP5 files giving output of html in apache2

I have followed following link to configure apache2 with php5.5.4: 我按照以下链接使用php5.5.4配置apache2:

http://php.net/manual/en/install.unix.apache2.php http://php.net/manual/zh/install.unix.apache2.php

Everything got properly configured without any error. 一切都已正确配置,没有任何错误。 But now whenever I am trying to implement .php file, the output is looking like html file. 但是现在无论何时我尝试实现.php文件,输出看起来都像html文件。

egfor following code 例如以下代码

   <html>
   <head>
     <title>PHP Test</title>
     </head>
    <body>
    <?php echo '<p>Hello World</p>'; ?> 
    </body>
    </html>

The output in browser is: 浏览器中的输出为:

Hello World 你好,世界

'; '; ?> ?>

BUt in command line it is showing properly, ie 在命令行中正确显示,即

 <html>
 <head>
 <title>PHP Test</title>
  </head>
  <body>
  <p>Hello World</p>
  </body>
  </html> 

Please guide in this aspect, since I have wasted so much time in this but in vain. 请在这方面进行指导,因为我在这方面浪费了很多时间,但徒劳无功。 My system is Linux redhat x86_64. 我的系统是Linux redhat x86_64。

If Apache is not interpreting PHP, then you might not have configured right steps 7 and 8 of its link. 如果Apache不解释PHP,则可能没有正确配置其链接的第7步和第8步。 Or not restarted apache after making the change in conf (step 9). 或在conf中进行更改后不重新启动apache(步骤9)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM