1

I want to use Laravel in my projects, but I faced a problem. Namely, I'm already using WAMP server as local server... I followed the instructions for installing Laravel inside WAMP... so I enabled openSSL first, then downloaded Composer, then tried composer command in the CMD, everything was fine so far... then created project... Composer has downloaded the dependencies... and everything looked perfect, but when I try localserver/myProject/public I get

Parse error: syntax error, unexpected T_CLASS, expecting T_STRING or T_VARIABLE or '$' in C:\wamp\www\myProject\public\index.php on line 50

It is strange to have any errors, since I didn't even touch the files inside the package... To mention, I am using WAMP 2.2 (PHP 5.3.1) on Windows XP, and installed Laravel 4.

Any ideas how to solve this issue?

Here is the index.php in the public folder:

    require __DIR__.'/../bootstrap/autoload.php';

    $app = require_once __DIR__.'/../bootstrap/app.php';

    $kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);//This is line 50

    $response = $kernel->handle(
        $request = Illuminate\Http\Request::capture()
    );

$response->send();

$kernel->terminate($request, $response);
  • 1
    show the code of `public\index.php` – w3spi Jun 10 '15 at 20:54
  • possible duplicate of [PHP Parse/Syntax Errors; and How to solve them?](http://stackoverflow.com/questions/18050071/php-parse-syntax-errors-and-how-to-solve-them) – castis Jun 10 '15 at 20:54
  • did you enable `mod_rewrite` module? – intelis Jun 10 '15 at 20:59
  • Yes, mod_rewrite is enabled. – Viktor Dojcinovski Jun 10 '15 at 21:27
  • @ViktorDojcinovski I do not thing it is a code problem, if you have one project in your WAMP then you need to make your point directory as root with public folder C:\wamp\www\myProject\public\ = localserver, if you plan multiple projects then I strongly suggest to make virtual hosts (vhost for xamp http://stackoverflow.com/questions/27754367/how-do-i-set-up-my-apache-virtualhost-settings-with-xampp-on-windows/27754990#27754990 as example) – Maytham Fahmi Jun 10 '15 at 21:44
  • I tried that. I made changes to the apache http.conf file, and changed the document root to C:\wamp\www\myProject\public\... but same again! – Viktor Dojcinovski Jun 10 '15 at 21:55
  • strange, I am not sure what could be else. but for me the xampp example worked fine with out any issues and I can create many projects with vhost, if that helps you could install xampp and follow my example and I hope it will work for you. – Maytham Fahmi Jun 10 '15 at 22:05
  • I solved it! There was version incompatibility of the PHP and laravel 5! I installed laravel 4 and everything works well! Thanks anyway!!! – Viktor Dojcinovski Jun 11 '15 at 19:24

1 Answers1

1
$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);//This is line 50

the ::class is only supported since PHP 5.5

Also you must have mistakingly installed laravel 5.1+ because that's the only version to require php 5.5+

Luceos
  • 6,629
  • 1
  • 35
  • 65