dpqmu84646 2013-08-05 19:11
浏览 37

嵌入式PHP不在html页面中显示

So im trying to begin a simple web page on an amazon ec2 ubuntu instance. I have apache2 installed, php, everything that is needed. When I set up my simple page it displays everything i have in the html except for the php code. Here is what I got so far.

<div id="leftdiv">
<h1> Test Inside Left Div </h1>
<br>
<?php date('m/d/y - h:i:s'); ?>
<br>
<p> Can you see the date above? </p>

</div>

Everything in the h1 tag and the p tag displays fine. But the date will not show up on the page. I have googled this extensively and all the solutions i have tried still do not work.

So far I have commented out the following in php5.conf.

<IfModule mod_php5.c>
<FilesMatch "\.ph(p3?|tml)$">
    SetHandler application/x-httpd-php
</FilesMatch>
<FilesMatch "\.phps$">
    SetHandler application/x-httpd-php-source
</FilesMatch>
# To re-enable php in user directories comment the following lines
# (from <IfModule ...> to </IfModule>.) Do NOT set it to On as it
# prevents .htaccess files from disabling it.
# <IfModule mod_userdir.c>
#     <Directory /home/*/public_html>
#         php_admin_value engine Off
#    </Directory>
#</IfModule>
</IfModule>

restarted apache2 and nothing. I have added the following two lines to the apache2.conf file.

AddType application/x-httpd-php .php
AddType application/x-httpd-php .html

Restarted apache2 and nothing. The file is saved as a .php file, so not sure what else it could be. I'd rather not have to write the entire file out in php when I just want it to be a simple one or two lines of it within the html. Any help would be appreciated.

  • 写回答

1条回答 默认 最新

  • duanlun1955 2013-08-05 19:12
    关注

    Because you weren't echoing it:

    <?php echo date('m/d/y - h:i:s'); ?>
    
    评论

报告相同问题?

悬赏问题

  • ¥15 python变量和列表之间的相互影响
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 关于大棚监测的pcb板设计
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)