1

When I create a laravel project everything goes smoothly with composer. However when I try to access the default index.php page i get a 500 error. After checking the logs I found it was a syntax error in Laravels source code. I found that it was '...' infront of the variable.

[Wed Nov 02 01:47:45.658110 2016] [:error] [pid 4561] [client 70.66.236.55:55751] PHP Parse error: syntax error, unexpected '.', expecting '&' or variable (T_VARIABLE) in /var/www/html/proj-dir/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php on line 475

After fixing that a new one would pop up. And this repeated several more times. Not sure if they are supposed to be there or not, but I assumed that '...$args' was not a valid syntax (even for laravel)

After "fixing" all the errors I get taken to an actual error message in the browser!

`

>     ErrorException in Gate.php line 132:
>     Missing argument 2 for Illuminate\Auth\Access\Gate::policy(), called in
> /var/www/html/proj-dir/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php
> on line 237 and defined
>     1. in Gate.php line 132
>     2. at HandleExceptions->handleError('2', 'Missing argument 2 for Illuminate\Auth\Access\Gate::policy(), called in
> /var/www/html/proj-dir/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php
> on line 237 and defined',
> '/var/www/html/proj-dir/vendor/laravel/framework/src/Illuminate/Auth/Access/Gate.php',
> '132', array('class' => array('App\Model',
> 'App\Policies\ModelPolicy'), 'this' => object(Gate))) in Gate.php line
> 132
>     3. at Gate->policy(array('App\Model', 'App\Policies\ModelPolicy')) in Facade.php line 237
>     4. at Facade::__callStatic('policy', array('App\Model', 'App\Policies\ModelPolicy')) in AuthServiceProvider.php line 25
>     5. at Gate::policy('App\Model', 'App\Policies\ModelPolicy') in AuthServiceProvider.php line 25
>     6. at AuthServiceProvider->registerPolicies() in AuthServiceProvider.php line 26
>     7. at AuthServiceProvider->boot()
>     8. at call_user_func_array(array(object(AuthServiceProvider), 'boot'), array()) in Container.php line 508
>     9. at Container->call(array(object(AuthServiceProvider), 'boot')) in Application.php line 769
>     10. at Application->bootProvider(object(AuthServiceProvider)) in Application.php line 752
>     11. at Application->Illuminate\Foundation\{closure}(object(AuthServiceProvider),
> '13')
>     12. at array_walk(array(object(EventServiceProvider), object(RoutingServiceProvider), object(AuthServiceProvider),
> object(CookieServiceProvider), object(DatabaseServiceProvider),
> object(EncryptionServiceProvider), object(FilesystemServiceProvider),
> object(FoundationServiceProvider),
> object(NotificationServiceProvider),
> object(PaginationServiceProvider), object(SessionServiceProvider),
> object(ViewServiceProvider), object(AppServiceProvider),
> object(AuthServiceProvider), object(EventServiceProvider),
> object(RouteServiceProvider)), object(Closure)) in Application.php
> line 753
>     13. at Application->boot() in BootProviders.php line 17
>     14. at BootProviders->bootstrap(object(Application)) in Application.php line 203
>     15. at Application->bootstrapWith(array('Illuminate\Foundation\Bootstrap\DetectEnvironment',
> 'Illuminate\Foundation\Bootstrap\LoadConfiguration',
> 'Illuminate\Foundation\Bootstrap\ConfigureLogging',
> 'Illuminate\Foundation\Bootstrap\HandleExceptions',
> 'Illuminate\Foundation\Bootstrap\RegisterFacades',
> 'Illuminate\Foundation\Bootstrap\RegisterProviders',
> 'Illuminate\Foundation\Bootstrap\BootProviders')) in Kernel.php line
> 253
>     16. at Kernel->bootstrap() in Kernel.php line 144
>     17. at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 116
>     18. at Kernel->handle(object(Request)) in index.php line 54

`

I have tried recreating the project multiple times, but always end up at the same place. Not really sure how to proceed.

Vision Coderz
  • 8,257
  • 5
  • 41
  • 57
DrProfesor
  • 27
  • 5

1 Answers1

4

FYI these aren't syntax errors. Most probably you're using an old version of PHP. Make sure your server meets following requirements:

PHP >= 5.6.4

OpenSSL PHP Extension

PDO PHP Extension

Mbstring PHP Extension

Tokenizer PHP Extension

XML PHP Extension

Also don't forget to give required permissions to directories like storage, bootstraps.

After installing Laravel, you may need to configure some permissions. Directories within the storage and the bootstrap/cache directories should be writable by your web server or Laravel will not run. If you are using the Homestead virtual machine, these permissions should already be set.

Here you'll find everything at a glance that are needed to up and running a laravel project.

https://laravel.com/docs/5.3

Mahfuzul Alam
  • 3,057
  • 14
  • 15