1

I followed Fideloper post about running laravel with hhvm, step by step. There are two projects hosted on my server, one is my blog which is based on wardrobe (laravel 4.1), and another project with laravel 5.

My blog has no issue with server errors and laravel log file; But the other project cannot create log files, and it won't show error page because of that.

I double checked storage folder permission. It is 777.

When I run php artisan serve (native php, not hhvm) and browse to it, the error page showed up, and log file was created. So something is wrong with hhvm I think.

How can I fix blank page, when running laravel 5 with hhvm, and an error occurred? How can I bring back the error page (or whoops page)

P.S. I have read related question like this and still have the problem.

P.S.S. If any information needed ask me and I will update the question.

Community
  • 1
  • 1
Behzadsh
  • 851
  • 1
  • 14
  • 30
  • You will probably have better luck asking this question on [Server Fault](http://serverfault.com/) which is for system administration questions. – zwol Mar 25 '15 at 20:42
  • some grammar fixes. I think what's needed from the OP is clarification as to what kind of help is sought for. – thor Mar 25 '15 at 20:57
  • HHVM (unfortunately) logs fatal errors to `/var/log/hhvm/error.log`. – ceejayoz Apr 24 '15 at 20:32
  • Have you solved this problem yet? I think I've got the same problem. I'm in Homestead and Lumen with HHVM. I get a blank page, no errors show. I can see the errors in `/var/log/hhvm/error.log` though. – prograhammer May 13 '15 at 18:18
  • 1
    I figured out what is going on: http://stackoverflow.com/questions/29789945/when-i-turn-on-hhvm-on-homestead-i-dont-get-any-syntax-error-or-missing-clas/30226587#30226587 – prograhammer May 13 '15 at 23:12
  • @DavidGraham please post it as an answer Thank you by the way – Behzadsh May 14 '15 at 08:59
  • Done. I put up a detailed answer, and made a few adjustments, see answer below – prograhammer May 14 '15 at 14:42
  • Updated answer to be more Laravel specific. Also reported this issue/fix on the Laravel github project. – prograhammer May 14 '15 at 19:05

2 Answers2

3

I suffered the same problem when I installed Laravel Homestead with HHVM. If you enter some random junk like sdfkjl into your routes file you'll get a blank page (however, if add a semi-colon sdfkjl; you get error output). The errors are being logged at /var/log/hhvm/error.log but they don't go to the browser, instead you just get a blank page. It appears this is intentional behavior for HHVM. It also appears Laravel tries to handle these but doesn't catch some of the fatals sent by HHVM. Thanks to clues from this github issue I decided to make some slight changes to Laravel's Foundation\Bootstrap\HandleExceptions.php to see if I could get it to catch all of these fatals:

First, update your /etc/hhvm/php.ini and add these settings:

hhvm.server.implicit_flush = true
hhvm.error_handling.call_user_handler_on_fatals = true

Before modifying a package source, let's remove the vendor\compiled.php with this artisan command:

$ php artisan clear-compiled

And let's set the environment sessons to array:

in your .env

SESSION_DRIVER=array

(You may also need to clear all the random-looking session files in storage/framework/sessions)

Now any changes we make to the Laravel package source will immediately reflect. Let's update a few things in the HandleExceptions class:

in vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php

// **** Add this to hold fatal error
protected static $fatalError = null;

...

public function handleError($level, $message, $file = '', $line = 0, $context = array())
{

   // **** Add this, loads fatal error
   if ($level & (1 << 24)) {
        self::$fatalError = array(
            'message' => $message,
            'type' => $level,
            'file' => $file,
            'line' => $line
        );
    }   

    if (error_reporting() & $level)
    {
        throw new ErrorException($message, 0, $level, $file, $line);
    }
} 

...   

// *** Update this function so it can handle the fatal
public function handleShutdown()
{
    $error = error_get_last();

    if(self::$fatalError){
        $error = self::$fatalError;
    }

    if ( ! is_null($error) && $this->isFatal($error['type']))
    {
        $this->handleException($this->fatalExceptionFromError($error, 0));
    }
}

...

protected function isFatal($type)
{
    // *** Add type 16777217 that HVVM returns for fatal
    return in_array($type, [16777217, E_ERROR, E_CORE_ERROR, E_COMPILE_ERROR, E_PARSE]);
}

...

Now type the random junk (no semi-colon) in your routes folder and you'll see the fatal display. I have now reported this issue to Taylor on the Laravel github. If you are in Lumen, I've got a solution here that will work until Lumen gets fixed as well.

prograhammer
  • 20,132
  • 13
  • 91
  • 118
-1

I also got the same issue. Give 755 permission to entire laravel project it's work for me

anyway you can check hhvm error log, run

$tail -n 50 -f /var/log/hhvm/error.log
TIJ
  • 2,771
  • 3
  • 19
  • 32