Laravel on the server Locaweb: Unexpected character in input: '\' (ASCII = 92) state = 1

2

I'm hosting at Locaweb and it's giving this error.

  

Warning: Unexpected character in input: '\' (ASCII = 92) state = 1 in   /home/storage/a/b7/b3/reciclaoleovegetal/public_html/public/index.php   online 52

     

Parse error: syntax error, unexpected T_STRING in   /home/storage/a/b7/b3/reciclaoleovegetal/public_html/public/index.php   online 52

    
asked by anonymous 25.09.2017 / 15:44

1 answer

5

Messages like:

Warning: Unexpected character in input: '\' (ASCII=92) state=1

E:

Parse error: syntax error, unexpected T_STRING

They indicate two possibilities, or you edited something that should not and broke the script, or you are using older version of PHP that does not support Laravel.

By the Unexpected character in input: '\' message you should be using PHP 5.2 , because namespaces only work from 5.3

But it's important to know that using ::class , which is in line 52 of index.php does not work in neither PHP 5.3:

$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);

To be sure of the version, create a file named info.php in public_html and add this:

<?php
echo 'Versão Atual do PHP: ' . phpversion();

It will display the details of the version of your PHP, so you will be sure if it is 7.1, if it is indeed the 7.1 then it means that either you damaged the index.php or the upload failed.

If the version is correct and index.php looks like this:

<?php

define('LARAVEL_START', microtime(true));

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

$app = require_once __DIR__.'/../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);

Then the problem is in upload, if you are using Filezilla, maybe your FTP is breaking something when trying to upload as ASCII, so do not lose data upload as binary, for example in Filezilla go to:

Transfer > Transfer type > and switch Auto with Binary

As in the image:

Then upload again.

    
25.09.2017 / 15:49