5

I install a LEMP server in ubuntu 12.04 LTS 64 whit HHVM Fastcgi Service and i install laravel via laravel.phar ( and test via composer too ) when in get my site in brwoser do not display any error but in chrome developer console get error 500 enter image description here

i can't see any error in error.log file ( laravel - hhvm , nginx )

the storage directory Permissions is 777

and my nginx.conf and vhosts file have basic configuration

when i use PHP CLI or hhvm command it's worked good

thanks for help me :)

my location block

location ~ \.(hh|php)$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_keep_conn on;
fastcgi_pass   127.0.0.1:9000;
fastcgi_index  index.php;
fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
include        fastcgi_params;
Mohammad
  • 652
  • 1
  • 7
  • 18
  • Take a look at [fideloper's install guide](http://fideloper.com/hhvm-nginx-laravel) as well as [the servers for hackers nginx guide](http://serversforhackers.com/editions/2014/03/25/nginx/) and put the two together. If you install nginx then hhvm, and you are using `hhvm 3.*` then HHVM will automatically add in a `hhvm.conf` file to `/etc/nginx/` then all you have to do is `include hhvm.conf` inside your server block. – CommandZ May 17 '14 at 01:53

3 Answers3

6

The problem with HHVM is it doesn't show much error, You have to keep watching the HHVM or Laravel error logs.

You'll want to pay close attention to your error logs. HHVM doesn't report errors to the browser by default.

Check the HHVM logs!

$ tail -n 50 -f /var/log/hhvm/error.log

Check your Laravel logs!

$ tail -n 50 -f /path/to/laravel/app/storage/logs/laravel.log

config reference

Create a file /etc/nginx/hhvm.conf if it doesn't exist yet. Insert the ff:

location ~ \.(hh|php)$ {
    fastcgi_keep_conn on;
    fastcgi_pass   127.0.0.1:9000;
    fastcgi_index  index.php;
    fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include        fastcgi_params;
}

Then include it on your nginx virtual host config.
eg. /etc/nginx/sites-available/laravel

Now add this for Laravel, edit as needed:

server {
    listen 80 default_server;

    root /vagrant/laravel/public;
    index index.html index.htm index.php;

    server_name localhost;

    access_log /var/log/nginx/localhost.laravel-access.log;
    error_log  /var/log/nginx/locahost.laravel-error.log error;

    charset utf-8;

    location / {
        try_files \$uri \$uri/ /index.php?\$query_string;
    }

    location = /favicon.ico { log_not_found off; access_log off; }
    location = /robots.txt  { log_not_found off; access_log off; }

    error_page 404 /index.php;      

    include hhvm.conf;  # INCLUDE HHVM HERE

    # Deny .htaccess file access
    location ~ /\.ht {
        deny all;
    }
}

Then reload Nginx:

$ sudo service nginx reload
majidarif
  • 18,694
  • 16
  • 88
  • 133
  • thanks @majidarif all ngnix config is tested okay , but when i install laravel connt run int from browser ! it's currently work in CLI – Mohammad Apr 23 '14 at 10:37
  • @user1873569 HHVM does not show errors on the browser by default. check my updated answer. – majidarif Apr 23 '14 at 10:39
  • in no have any error on laravel.log but in hhvm/error.log have error Fatal error: unexpected St13runtime_error: locale::facet::_S_create_c_locale name not valid then fix it before install laravel – Mohammad Apr 23 '14 at 10:44
  • @hannesvdvreken i know about it , and fixed this error ! thanks :) – Mohammad Apr 23 '14 at 15:15
0

Since the X-Powered-By header is set by HHVM I assume your NGINX is configured correct. A 500 error mostly comes from a syntax error or an exception thrown in your application. Maybe your fastcgi settings in NGINX are still wrong. What's inside the location *\.php block?

Try for a less error-prone setup and run php artisan serve to locally host your project.

hannesvdvreken
  • 4,858
  • 1
  • 15
  • 17
0

You can modify Laravel's handle exception class to display the errors while HHVM is being used.

Full details here: https://github.com/laravel/framework/issues/8744#issue-76454458

I have tested this and It works well on Laravel 5.2/5.3 on Homestead with HHVM.

haris
  • 3,775
  • 1
  • 25
  • 28