title: Ubuntu 16.04 - Nginx Laravel 500 HTTP error
body: <p>I'm trying to startup a Laravel project through nginx but I'm stuck at the HTTP 500 error. I tried <code>sudo chmod 777 -R storage</code> also tried with <code>755</code>. Have already user <code>php artisan cache:clear</code>. Here is my config <code>/etc/nginx/sites-enabled/default</code></p>
  
  <pre><code>server {
      listen 80;
      listen [::]:80;
  
      server_name cbattles.com www.cbattles.com;
  
      root /home/enthys/workspace/CodeBattles/public;
      index index.php index.html index.htm;
  
      location / {
              try_files $uri $uri/ /index.php?$query_string;
      }
  
      location ~ \.php$ {
              try_files $uri =404;
              fastcgi_split_path_info ^(.+\.php)(/.+)$;
              fastcgi_pass unix:/run/php/php7.0-fpm.sock;
              fastcgi_index index.php;
              fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
              include fastcgi_params;
      }
  }
  </code></pre>
  
  <p>In my <code>/var/log/nginx/error.log</code> I get the error </p>
  
  <blockquote>
    <p>2018/03/06 20:33:16 [error] 4090#4090: *10 FastCGI sent in stderr:
    "PHP message: PHP Parse error:  syntax error, unexpected '?',
    expecting variable (T_VARIABLE) in
    /home/enthys/workspace/CodeBattles/vendor/symfony/finder/Comparator/NumberComparator.php
    on line 42 PHP message: PHP Fatal error:  Exception thrown without a
    stack frame in Unknown on line 0 PHP message: PHP Parse error:  syntax
    error, unexpected '?', expecting variable (T_VARIABLE) in
    /home/enthys/workspace/CodeBattles/vendor/symfony/finder/Comparator/NumberComparator.php
    on line 42 PHP message: PHP Fatal error:  Exception thrown without a
    stack frame in Unknown on line 0" while reading response header from
    upstream, client: 127.0.0.1, server: cbattles.com, request: "GET /
    HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.0-fpm.sock:", host:
    "cbattles.com"</p>
  </blockquote>
  
  <p>The <code>storage/logs/laravel.log</code> states</p>
  
  <pre><code>[2018-03-06 18:33:16] local.ERROR: Parse error: syntax error, unexpected '?', expecting variable (T_VARIABLE) {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalThrowableError(code: 0): Parse error: syntax error, unexpected '?', expecting variable (T_VARIABLE) at /home/enthys/workspace/CodeBattles/vendor/symfony/finder/Comparator/NumberComparator.php:42)
  [stacktrace]
  #0 /home/enthys/workspace/CodeBattles/vendor/composer/ClassLoader.php(301): Composer\\Autoload\\includeFile('/home/enthys/wo...')
  #1 [internal function]: Composer\\Autoload\\ClassLoader-&gt;loadClass('Symfony\\\\Compone...')
  #2 /home/enthys/workspace/CodeBattles/vendor/symfony/finder/Finder.php(120): spl_autoload_call('Symfony\\\\Compone...')
  #3 /home/enthys/workspace/CodeBattles/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php(420): Symfony\\Component\\Finder\\Finder-&gt;depth(0)
  #4 /home/enthys/workspace/CodeBattles/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(381): Illuminate\\Filesystem\\Filesystem-&gt;directories('/home/enthys/wo...')
  #5 /home/enthys/workspace/CodeBattles/vendor/laravel/framework/src/Illuminate/Support/helpers.php(1038): Illuminate\\Foundation\\Exceptions\\Handler-&gt;Illuminate\\Foundation\\Exceptions\\{closure}(Object(Whoops\\Handler\\PrettyPageHandler))
  #6 /home/enthys/workspace/CodeBattles/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(384): tap(Object(Whoops\\Handler\\PrettyPageHandler), Object(Closure))
  #7 /home/enthys/workspace/CodeBattles/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(334): Illuminate\\Foundation\\Exceptions\\Handler-&gt;whoopsHandler()
  #8 /home/enthys/workspace/CodeBattles/vendor/laravel/framework/src/Illuminate/Support/helpers.php(1038): Illuminate\\Foundation\\Exceptions\\Handler-&gt;Illuminate\\Foundation\\Exceptions\\{closure}(Object(Whoops\\Run))
  #9 /home/enthys/workspace/CodeBattles/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(339): tap(Object(Whoops\\Run), Object(Closure))
  #10 /home/enthys/workspace/CodeBattles/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(314): Illuminate\\Foundation\\Exceptions\\Handler-&gt;renderExceptionWithWhoops(Object(Symfony\\Component\\Debug\\Exception\\FatalThrowableError))
  #11 /home/enthys/workspace/CodeBattles/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(287): Illuminate\\Foundation\\Exceptions\\Handler-&gt;convertExceptionToResponse(Object(Symfony\\Component\\Debug\\Exception\\FatalThrowableError))
  #12 /home/enthys/workspace/CodeBattles/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(188): Illuminate\\Foundation\\Exceptions\\Handler-&gt;prepareResponse(Object(Illuminate\\Http\\Request), Object(Symfony\\Component\\Debug\\Exception\\FatalThrowableError))
  #13 /home/enthys/workspace/CodeBattles/app/Exceptions/Handler.php(51): Illuminate\\Foundation\\Exceptions\\Handler-&gt;render(Object(Illuminate\\Http\\Request), Object(Symfony\\Component\\Debug\\Exception\\FatalThrowableError))
  #14 /home/enthys/workspace/CodeBattles/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(326): App\\Exceptions\\Handler-&gt;render(Object(Illuminate\\Http\\Request), Object(Symfony\\Component\\Debug\\Exception\\FatalThrowableError))
  #15 /home/enthys/workspace/CodeBattles/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(124): Illuminate\\Foundation\\Http\\Kernel-&gt;renderException(Object(Illuminate\\Http\\Request), Object(Symfony\\Component\\Debug\\Exception\\FatalThrowableError))
  #16 /home/enthys/workspace/CodeBattles/public/index.php(55): Illuminate\\Foundation\\Http\\Kernel-&gt;handle(Object(Illuminate\\Http\\Request))
  #17 {main}
  "} 
  [2018-03-06 18:33:16] local.ERROR: Exception thrown without a stack frame {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalErrorException(code: 16): Exception thrown without a stack frame at Unknown:0)
  [stacktrace]
  #0 {main}
  "} 
  </code></pre>