smartrahat
smartrahat

Reputation: 5609

Parse error after deploy Laravel 5.1 on shared hosting

I am using Laravel 5.1

To get rid of Public folder:

  1. I moved everything in a folder named 'root' except public folder.

  2. Move all public folder content in Root.

  3. Changed require __DIR__.'/root/bootstrap/autoload.php'; & $app = require_once __DIR__.'/root/bootstrap/app.php'; in index.php at root folder.

Everything is working perfectly in localhost. I uploaded my project in a shared hosting. And change database information in .env and change the url in Config\App.php 'url' => 'localhost', to 'url' => 'http://zamzam-transport.com/',.

Now when I go to myproject.com it shows a Parse error Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in /home/zamzamtransport/public_html/index.php on line 50

index.php:

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

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

$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);
$response = $kernel->handle(
    $request = Illuminate\Http\Request::capture()
);

$response->send();

$kernel->terminate($request, $response);

Another problem is my .env file is accessible.

Update at: 12 August 2015 My server is updated to PHP5.6 the site starts working but the .env file is still accessible.

Upvotes: 0

Views: 1861

Answers (1)

Kiran Subedi
Kiran Subedi

Reputation: 2284

I had also faced similar problem. After doing some research , I found that laravel didn't support the php version.

laravel 5.1 will support only PHP >= 5.5.9

So,before set upping your laravel project make sure that the server requirements for the laravel are satisfied.

For more information see Laravel Site

Upvotes: 1

Related Questions