1

So I have this page that I was working on yesterday, and I had some errors and was still finishing up everyhing on it but when i stopped i loaded the page fine. Yet today when i loaded the page it was blank, well not completely blank but it stops loading the content at a certain point in the file (see below).

Now the weird thing is if i put this in comments it doesn't change anything, when I put ALL the php code it even doesnt change anything. So I'm kind of stuck....

EDIT: So I just realised I forgot to give the link, though when looking online it gives a full blank page... http://hmorreels.hol.es/Morreels_App/index.php/charts Sadly though it's a internal 500 Error so not much information there :/

Maybe one of you guys see it ? I've put the page online and I'm dropping my code here... This page uses laravel as a framework but most of the page is simple 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>
Rafael Lambelin
  • 286
  • 2
  • 10

3 Answers3

1

You have wrong web server configuration. Your web server (Apache, Nginx) should be pointed to a public directory. Corrent URL with correct settings will be:

http://hmorreels.hol.es/charts 

But not:

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

If you're using Apache, please read this.

Also, don't forget to set correct permissions on a storage folder, for Unix it will be:

chmod -R 775 storage
Alexey Mezenin
  • 158,981
  • 26
  • 290
  • 279
  • I know just not gonna spend my time doing this on a free server that doesnt allow any changes to the htaccess file, if I'm moving it to a production server in a couple of weeks where it is already set up to work like this :) – Rafael Lambelin Apr 15 '16 at 08:00
  • The thing is you may get strange behavior like you have here just because of wrong configuration. – Alexey Mezenin Apr 15 '16 at 08:01
  • Oh really ? :o That, my good sir is something I did not know :) (Sadly I don't have many other options when it comes to free testing servers :/ and the .htaccess file is not accessible so propably not a possible fix :/) Maybe once the production server is running i can test on there (if error still persists) – Rafael Lambelin Apr 15 '16 at 08:09
1

Within Laravel, you can set a break point within Exceptions/Handler or just Log::error($e). That will capture all exception. It may caused by error and redirection.

Have you check the laravel log and apache/nginx log?

Yifan Fan
  • 196
  • 5
  • Sorry to seem like a newb here, but I have never used Log::error($e) before and doesnt seem to want to be called statically and can't seem to find anything about how to put this in my file (laravel site says to type as you did exactly) but this doesn't work for me. – Rafael Lambelin Apr 15 '16 at 08:08
0

I fixed it, this was my fault guys , I am terribly sorry, the SQL function was trying to load 641.574 lines from my MySQL table.

This feed system is running 24/7 and I didn't consider that it's too big since I only recently removed the limiter from my table :)

So..., Sorry for wasting your time with this... Though you did teach me a bit about error logs ;)

Thanks a million for your help anyways guys really appreciate it !

Rafael Lambelin
  • 286
  • 2
  • 10