Timothy Stringer

Q: Waiting for localhost . . .

and waiting and waiting and waiting. 

 

I have a small php/mysql script that, when I run it, the message 'waiting for localhost' comes up.  Sometimes localhost responds in a short time, but most of the time, 30-45 and even 60 seconds go by.  I have reinstalled everything from scratch and still the problem exists.  Any ideas?

 

The gorie details:

 

MacBook Pro, 2.26 Ghz Core 2 duo, 2 gig RAM

OS 10.8.4

PHP 5.3.15

Apache 2.2.22

MySQL 5.7.1-m11

MacBook Pro, OS X Mountain Lion (10.8.4), 2.26 Core 2 Duo, 2 GB RAM

Posted on Jul 22, 2013 2:33 PM

Close

Q: Waiting for localhost . . .

  • All replies
  • Helpful answers

  • by MrHoffman,

    MrHoffman MrHoffman Jul 22, 2013 4:30 PM in response to Timothy Stringer
    Level 6 (15,627 points)
    Mac OS X
    Jul 22, 2013 4:30 PM in response to Timothy Stringer

    Your (unspecified) small php script cannot figure out how to reliably connect to the current computer. 

     

    The localhost stuff is "me" in IP-network-speak; the current host. 

     

    This then implies a problem with the local IP network configuration, or confusion within the php code within the script. 

     

    Given this particular software configuration apparently involved loading several fairly complex pacakage, software installation or configuration errors are also in play here. 

     

    You're either going to have to debug the php script, or get somebody to debug it for you, or — if you want to try debugging this matter here — please post the code of particular php script in use or the identity of the script if it's part of an open-source package, and the exact text of the error message(s) you're receiving.

  • by Timothy Stringer,

    Timothy Stringer Timothy Stringer Jul 22, 2013 8:20 PM in response to MrHoffman
    Level 1 (25 points)
    Jul 22, 2013 8:20 PM in response to MrHoffman

    You asked for it . . .

     

    <?php

    error_reporting(E_ALL);

    ini_set('display_errors', TRUE);

    ini_set('display_startup_errors', TRUE);

     

     

     

    session_name("PassTech");

    session_start();

    set_time_limit (60);

    gc_enable(); // Enable Garbage Collector

    var_dump(gc_enabled()); // true

    var_dump(gc_collect_cycles()); // # of elements cleaned up

    gc_disable(); // Disable Garbage Collecto

     

     

    ob_end_clean();

     

     

    $BeginTime = date('H:i:s');

    echo $BeginTime;

     

     

     

    define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');

     

     

    $SystemNum = $_SESSION['SystemNum'];

     

     

    for($Joe = 1; $Joe <= 75; $Joe++) {

              if ($SystemNum == 0) $SystemNumEntry = $Joe;

                        else $SystemNumEntry = $SystemNum;

     

    $_SESSION['SystemNumEntry'] = $SystemNumEntry;

     

     

    include "ImportCSV.php";

     

    echo '<br><br>' . $SystemNum . ' xx ' . $SystemNumEntry . '<br><br>';

     

    $System = $_SESSION['System'];

    $EndMO = $_SESSION['EndMO'];

    $FileName = $System . '--' . $EndMO . '.xlsx';

     

     

    $WriteFile = $_SESSION['FileName'];

    $Path = '/Users/tim/Sites/classes/MonthlyReports/';

    $FileOut = $Path . $WriteFile;

     

     

    echo $System;

     

     

    /** Include PHPExcel_IOFactory */

    require_once '../Classes/PHPExcel/IOFactory.php';

     

     

     

     

    // Save Excel 2007 file

    echo date('H:i:s') , " Write to Excel2007 format" , EOL;

    $callStartTime = microtime(true);

     

    $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');

     

    $objWriter->save($FileOut, __FILE__);

     

    if($SystemNum != 0) die('only one');

     

     

    if ($_SESSION['GrandWorkOrders'] == 0 && $_SESSION['GrandCallCount'] == 0) { unlink($FileOut = $Path . $WriteFile);

    echo $System . ' deleted for no work';

    }

     

     

     

     

    }

     

    ?>

  • by MrHoffman,

    MrHoffman MrHoffman Jul 23, 2013 7:34 AM in response to Timothy Stringer
    Level 6 (15,627 points)
    Mac OS X
    Jul 23, 2013 7:34 AM in response to Timothy Stringer

    In general and FWIW, the folks here probably aren't the best resource for help with troubleshooting random php packages, particularly one with the listed set of add-on prerequisite packages.

     

    I'd suggest contacting the maintainers of PHPExcel package for assistance with this package.  This looks to be a large and complex package as I see calls into all sorts of other code well beyond what's posted and there's a list of fairly complex prerequisites — and I don't see any references to "localhost" in what's posted.

     

    Alternatively, work with somebody that can configure and troubleshoot this package for you.

     

    Though I'm probably not going to be able to troubleshoot the php errors here and debugging php code, what's the exact error message text you're receiving, and where is that error issued in the php code?  Those sorts of details might help you with researching other existing reports of this error, or of similar errors.

  • by Timothy Stringer,

    Timothy Stringer Timothy Stringer Jul 24, 2013 12:39 PM in response to MrHoffman
    Level 1 (25 points)
    Jul 24, 2013 12:39 PM in response to MrHoffman

    You may be able to help after all.  There has got to be something sick with this server.  Now, this script is sticking, which once executed in less than a heartbeat.

     

     

    _______

     

    <?php

    session_name("PassTech");

    session_start();

    ?>

     

    <!DOCTYPE html >

     

    <head>

    <link rel="stylesheet" type="text/css" href="Dispatch.css">

     

    <style>

    form input {

              font-size: 12px;

        width: 150px;

        height: 14px;

              text-align:center;

              margin-left:auto;

              margin-right:auto;    

    }

     

     

    form textarea {

    width: 160px;

    height: 13px;

    margin-left:auto;

    margin-right:auto;

    }

     

     

    .inputbox{

      border: 1px solid #666;

      width: 180px;

      height: 10px;

      font-size: 1em;

    }

     

    </style>

     

    <link rel="stylesheet" type="text/css" href="anytime.css" />

    <script src="jquery.js"></script>

    <script src="jquery-migrate.js"></script><!-- if jQuery 1.9+ -->

    <script src="anytime.js"></script>

     

    <title>Lookup</title>

     

    </head>

    <body>

     

    <p><IMG class="displayed" src="Images/Easy_logo.gif" width="225px" height="70px" /></p><br />

     

    <div class = "center" style="width:400px; margin:auto">

    <form action="Branch.php" method="post" class="center">

    <br><br><p>Select Date</p>


    <?php

    echo $_POST['SystemNum'];

    $_SESSION['SystemNum'] = $_POST['SystemNum'];

     

    echo '<input type="text" id="field1" name="LastDate" size="50" lable = "Select Date<br>" value="' . date("m-d-Y", time()) . '" /><br/>';

          ?>    

    <script>

      AnyTime.picker( "field1",

        { format: "%m-%d-%Y", firstDOW: 0 } );

      $("#field2").AnyTime_picker(

        { format: "%H:%i", labelTitle: "Hora",

          labelHour: "Hora", labelMinute: "Minuto" } );

    </script>

    <br>

     

    <div style="width:200px; margin-left:auto; margin-right:auto">

    <label>Daily Report<br /></label>

    <input type="submit" value="Daily" class='FormButton' name = "Daily" value="Go"/>

    <br /><br />

     

    <label>Weekly Report<br /></label>

    <input type="submit" value="Weekly" class='FormButton' name = "Weekly" /><br /><br />

     

    <label>Monthly Report<br /></label>

    <input type="submit" value="Monthly" class='FormButton' name = "Monthly" /><br /><br />

     

    </div>

     

    </form>

    </body>

    </html>

  • by Timothy Stringer,

    Timothy Stringer Timothy Stringer Jul 24, 2013 2:39 PM in response to Timothy Stringer
    Level 1 (25 points)
    Jul 24, 2013 2:39 PM in response to Timothy Stringer

    Upon further reveiw, the server has to be to blame.  The problem is not in the scripts, but in the transitions between the scripts.  I've tried calling various scripts from my index.php file, and sometimes the transition happens instantly, and sometimes it hangs.  Sometimes, even the index script will pause for several seconds before launching.

     

    Where shoud I go from here?

  • by Esger,

    Esger Esger Apr 5, 2016 1:17 AM in response to Timothy Stringer
    Level 1 (4 points)
    Apr 5, 2016 1:17 AM in response to Timothy Stringer

    This problem still exists in El Capitan; still no solution from Apple???