简体   繁体   English

php文件中的html内容不会在centos服务器中显示

[英]html content in php file wont display in centos server

I just finished testing my app in the local wamp server and transfered them to my centos VPS which is basically a lamp stack. 我刚刚在本地Wamp服务器中测试了我的应用程序,然后将它们转移到了我的centos VPS(基本上是一个灯泡堆栈)上。 The problem is, many of my .php files which have html content in them are not displayed properly in there. 问题是,我的许多具有html内容的.php文件都没有正确显示在其中。 Here is an example 这是一个例子

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <title>
            Tailor Management - Order Details
        </title>

    </head>
    <body>
        <div align="center">
            <h1>
                Order Details
            </h1>
        </div>
        <div style="float: right; margin-right: 10px; background-color: #fe6154; border:2px;">
            <table>
                <tr>
                    <td>
                        <img src="images/blank.png" />
                    </td>
                    <td>
                        <img src="images/1.png" />
                    </td>
                    <td>
                        <img src="images/2.png" />
                    </td>
                    <td>
                        <img src="images/3.png" />
                    </td>
                </tr>
            </table>
        </div>
        <table id="tfhover" class="tftable" border="1">
            <tr>
                <th>
                    Oid
                </th>
                <th>
                    Cusid
                </th>
                <th>
                    Type
                </th>
                <th>
                    I-Date
                </th>
                <th>
                    D-Date
                </th>
                <th>
                    Quan
                </th>
                <th>
                    Rate
                </th>
                <th>
                    Price
                </th>
                <th>
                    Comments
                </th>
                <th>
                    Status
                </th>
                <th>
                    Details
                </th>

            </tr>
            <?php

            .....
                    ?>
                <form name="v_order" method="POST" action="o_processor.php">
                <?php

                ........
                ?>
                <tr style="background-color:<?php echo $color; ?>">
                    <td>
                        <input type="text" name = "oid[]"  class="inp-form-oid" readonly value ="<?php echo $oid[$counter]; ?>"/>
                    </td>
                    <td>
                        <input type="text" name = "cusid[]" class="inp-form-oid" readonly value ="<?php echo $cusid[$counter]; ?>"/>
                    </td>
                    <td>
                        <input type="text" name = "type[]"  class="inp-form-oid" value ="<?php echo $otype[$counter]; ?>" />
                    </td>
                    <td>
                        <input type="text" name = "idate[]"  class="inp-form-oid" value ="<?php $date = new DateTime($idate[$counter]); echo $date->format('d-m-Y'); ?>" />
                    </td>
                    <td>
                        <input type="text" name = "ddate[]"  class="inp-form-oid" value ="<?php $date = new DateTime($ddate[$counter]); echo $date->format('d-m-Y'); ?>" />
                    </td>
                    <td>
                        <input type="text" name = "quan[]"  class="inp-form-oid" value ="<?php echo $quan[$counter]; ?>" />
                    </td>
                    <td>
                        <input type="text" name = "rate[]"  class="inp-form-oid" value ="<?php echo $rate[$counter]; ?>" />
                    </td>
                    <td>
                        <input type="text" name = "price[]" class="inp-form-oid" value ="<?php echo $price[$counter]; ?>" />
                    </td>
                    <td>
                        <textarea name="comments[]" rows="2" cols="8"><?php echo $comments[$counter]; ?></textarea>
                    </td>
                    <td>

                        <label>
                            <input type="checkbox" name="ready[]"  value ="<?php echo $oid[$counter]; ?>" <?php  $status[$counter];
                            if($status[$counter] == 3){
                                echo 'checked';
                            } ?>/>Ready
                        </label>
                        <label>
                            <input type="checkbox" name="done[]"  value ="<?php echo $oid[$counter]; ?>" <?php  $status[$counter];
                            if($status[$counter] == 4){
                                echo 'checked';
                            } ?>/>Done
                        </label>
                        <label>
                            <input type="checkbox"  name ="cancel[]" value ="<?php echo $oid[$counter]; ?>"/>Cancel
                        </label>


                    </td>
                    <td>

                            <a href="detail.php?oid=<?php echo $oid[$counter];?>" target="_blank">
                                Order Details
                            </a>&nbsp;&nbsp;|&nbsp;&nbsp;
                            <a href="cust_detail.php?oid=<?php echo $oid[$counter];?>" target="_blank">
                                Cust Details
                            </a>&nbsp;&nbsp;|&nbsp;&nbsp;
                            <a href="emp_detail.php?oid=<?php echo $oid[$counter];?>" target="_blank">
                                Emp Details
                            </a>

                    </td>

                </tr>

                <?php
                $color = "#ffff";
            }
            ?>
            <div align="center">
                <table style="margin-left:auto;margin-right:auto;margin-top: 40px;">
                    <td>
                        <input type="submit" value="Submit" style="width:150px; height: 60px;" />
                    </td>
                </table>
            </div>
            </form>
        </table>
    </body>
</html>

This code when running on my production server displays a page that looks like this 在我的生产服务器上运行时,此代码显示一个如下所示的页面

在本地Wamp服务器上运行时的页面

But when running on the centos VPS this same page is looking like this 但是在centos VPS上运行时,此页面看起来像这样

在centos上运行时的页面

I have checked that the sql queries are running just fine by manually running them the sql connectivity is fine too. 我已经通过手动运行它们来检查sql查询是否运行正常,sql连接也很好。

I have done a clean install of the lamp for 3 time now but still getting the same error. 我已经完成了3次全新的灯泡安装,但是仍然出现相同的错误。 Does anyone have any idea as to why this is happening? 有谁知道为什么会这样吗? Some suggestion on how to solve this would be great. 关于如何解决此问题的一些建议会很棒。

PS:- I tried to ask this question in serverfault but it wont let me post the screenshots because I didn't have 10 reputation points in there, so sorry if this is not the right place to ask this question. PS:-我试图在serverfault中问这个问题,但是它不允许我发布屏幕截图,因为我在那里没有10个信誉点,所以如果这不是问这个问题的正确位置,请您抱歉。

As suggested by Mike W on checking the server log I found that the error in there was 正如Mike W在检查服务器日志时所建议的那样,我发现其中存在错误

[Fri Oct 11 01:12:14 2013] [error] [client 108.162.222.156] PHP Warning: phpinfo(): It is not safe to rely on the system's timezone settings. [2013年10月11日星期五,01:12:14] [错误] [客户端108.162.222.156] PHP警告:phpinfo():依靠系统的时区设置并不安全。 You are required to use the date.timezone setting or the date_default_timezone_set() function. 您需要使用date.timezone设置或date_default_timezone_set()函数。 In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. 如果您使用了这些方法中的任何一种,并且仍然收到此警告,则很可能您拼写了时区标识符。 We selected 'America/New_York' for 'EDT/-4.0/DST' instead in /var/www/html/info.php on line 2 我们在第2行的/var/www/html/info.php中将“ EDT / -4.0 / DST”选择为“ America / New_York”

Modifying the php.ini file to add the correct date.timezone did the work and now the page is displaying correctly 修改php.ini文件以添加正确的date.timezone可以完成工作,现在页面可以正确显示

I found two error 我发现两个错误

1) please remove the extra php tags and ..... from your code 1)请从您的代码中删除多余的php标记和.....

<?php

        .....
                ?>

2) there is a extra } after $color = "#ffff"; 2) $color = "#ffff";后还有一个额外的} $color = "#ffff";

 <?php
                $color = "#ffff";
            }
            ?>

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

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