PHP给了我一个空白页面

时间:2016-04-15 07:33:07

标签: php laravel debugging webpage

所以我有这个页面,我昨天正在处理,我有一些错误,并且仍然完成了对它的关注,但当我停止时,我加载页面很好。然而今天当我加载页面时它是空白的,但不是完全空白,但它停止在文件中的某个点加载内容(见下文)。

现在奇怪的是,如果我把它放在评论中它没有改变任何东西,当我把所有的PHP代码它甚至没有改变任何东西。所以我有点卡住......

编辑:所以我刚才意识到我忘了给出这个链接,不过在网上查看它会给出一个完整的空白页面...... http://hmorreels.hol.es/Morreels_App/index.php/charts 可悲的是,虽然它是一个内部500错误所以没有太多信息:/

也许你们其中一个人看到了吗? 我已经把网页放在网上了,我在这里丢弃我的代码...... 这个页面使用laravel作为框架,但大多数页面都是简单的PHP。

<?php
use Illuminate\Support\Facades\DB;
include "config.php";
$init = false;

/* Check if the charts page is given a company ID or not */
/* ===================================================== */
if (isset($company_identifier)) {
    /* The page has gotten the company ID, this means we can go forth and do our calculations, show the graphs and stuffs */
    /*     ================================================================================    ================================== */
    $init = true;
}

$raspis = DB::table("raspi_installations")->get();
foreach ($raspis as $raspi) {
    $val = $raspi["serial_ID"];
    $val = "raspi_" . $val;
    $$val = $raspi;
}

$companies = DB::table('companies')->get();

foreach ($companies as $table) {
//die() WORKS UNTIL THIS LINE AFTER THE NEXT ONE IT STOPS WORKING
//===============================================================


        $$table['company_identifier'] = DB::table($table['company_identifier'])->get();

}

$engineers = DB::table('users')->get();
$Hydrauliek_Morreels_NV = DB::table('Hydrauliek_Morreels_NV')->get();
$i=0;

?>

<head>

    <link rel="stylesheet" href="/Morreels_App/public/styles/css/charts.css">
</head>
<html>

<body>
<?php include "header.php"; ?>

<div id="main_panel">

    <div class="flowx" id="panelhead" style="height:300px;">
        <div class="col colspan-3-of-3">
            <h1>Charts</h1>
            <p><?php echo trans('panelheaders.charts'); ?></p>
            <br/>
            <select name="company" id="company">
                   <?php foreach($companies as $company) : ?>
                      <option id="" value="/Morreels_App/index.php/charts/<?php echo $company["id"]; ?>"><?php echo $company["company"]; ?></option>
                   <?php endforeach; ?>
            </select>

            <?php foreach($companies as $company) : ?>
                <div id="<?php echo $company["company_identifier"]; ?>">
                    <form action="<?php echo $company["id"]; ?>">


                        <?php foreach($$company["company_identifier"] as $row):?>
                            <?php $name = "raspi_" . $row["raspi_ID"]; $current_dxd = $$name; die(print_r($$name)); ?>
                            <?php foreach ($row as $key => $value): ?>
                                <?php if($key == "temperature" || $key == "rH" || $key == "oilfilter_1" || $key == "oilfilter_2" || $key == "oilfilter_3"): ?>
                                    <label for="<?php echo $key; ?>"><input type="checkbox" value="<?php echo $value; ?>" name="<?php echo $value; ?>" id="<?php echo $key; ?>"><?php echo $key; ?></label>
                                <?php endif; ?>
                                <?php if($key != "temperature" && $key != "rH" && $key != "oilfilter_1" && $key != "oilfilter_2" && $key != "oilfilter_3" && $key != "updated" && $key != "entry_ID"): ?>
                                    <label for="<?php echo $current_dxd[$key]; ?>"><input type="checkbox" value="<?php echo $value; ?>" name="<?php echo $value; ?>" id="<?php echo $current_dxd[$key]; ?>"><?php echo $current_dxd[$key]; ?></label>
                                <?php endif; ?>

                            <?php endforeach; ?>
                        <?php endforeach; ?>
                    </form>
                </div>
            <?php endforeach; ?>



        </div>



    </div>

    <div id="content" style="background-color: #ECF2F6">

        <?php if($init): ?>
            <div class="col colspan-2-of-3 chart">
                <h1>
                    <?php
                    $id = $company_identifier - 1;
                    echo $companies[$id]['company'];
                    ?>
                </h1>

            </div>
            <div class="col colspan-1-of-3">


                <div id="action_holder">
                    <p>If you wish to see the graphs in detail and stop the     live feed of them, please click here,</p>
                    <button class="btn btn-default" id="STOP">Stop</button>
                </div>
                <div id="action_holder2">
                    <p> <?php echo trans('panelheaders.charts2'); ?></p>
                    <a style='text-decoration: none;' href='<?php echo $url;     ?>'><button class='btn btn-primary'><?php echo trans('basic.reload'); ?>    </button></a>
                </div>

            </div>
            <!-- CHART 1: TEMPERATURE -->
            <div id="temperature_chart" class="col colspan-3-of-3">



            </div>

            <div id="rH_chart" class="col colspan-3-of-3">



            </div>


            <!-- CHART 2: PM CHARTS -->
            <div class="chart col colspan-3-of-3">
                <div id="pm_chart_holder">

                </div>
            </div>
        <?php endif; ?>

    </div>


    <script type="text/javascript" src="/Morreels_App/public/chartjs/Chart.js"></script>
    <script src="/Morreels_App/public/scripts/js/chartfeed.js"></script>
    <script>

    </script>
</body>
</html>

3 个答案:

答案 0 :(得分:1)

您的网络服务器配置错误。您的Web服务器(Apache,Nginx)应指向public目录。具有正确设置的Corrent URL将为:

http://hmorreels.hol.es/charts 

但不是:

http://hmorreels.hol.es/Morreels_App/index.php/charts 

如果您使用的是Apache,请read this

另外,不要忘记在storage文件夹上设置正确的权限,对于Unix,它将是:

chmod -R 775 storage

答案 1 :(得分:1)

在Laravel中,您可以在Exceptions / Handler中设置断点,或者只设置Log :: error($ e)。这将捕获所有异常。它可能是由错误和重定向引起的。

您是否检查了laravel日志和apache / nginx日志?

答案 2 :(得分:0)

我修复了它,这是我的错误,我非常抱歉,SQL函数试图从MySQL表中加载641.574行。

这个饲料系统全天候运行,我不认为它太大了,因为我最近才从我的桌子上移除了限制器:)

所以...,抱歉浪费你的时间......虽然你确实教过我一些错误日志;)

感谢一百万人的帮助,无论如何,人们真的很感激!