3

I for some reason am getting an error when trying to deploy my app to a shared host.

I am getting this error :

Parse error: syntax error, unexpected '[' in public_html/dev/vendor/laravel/framework/src/Illuminate/Support/helpers.php on line 411

function class_uses_recursive($class)
{
    $results = [];

    foreach (array_merge([$class => $class], class_parents($class)) as $class)
    {
        $results += trait_uses_recursive($class);
    }

    return array_unique($results);
}

I am aware that Laravel 4 needs PHP >= 5.4 and I am currently running 5.4 on my host, as well as my dev environment (which the app runs fine) and in the code above I am aware that '[ ]' is shorthand for the older array();

This is probably something I am just overlooking but my brain seems to be not working well this morning.

Thanks in advance!

3
  • 2
    you sure you have PHP5.4 on your host? looks a 5.3 error to me... Commented Jul 30, 2014 at 13:32
  • 3
    Try <?php phpinfo(); ?> and make sure that it says PHP 5.4 Commented Jul 30, 2014 at 13:35
  • Ugh. You guys are absolutely right. The shared host was defaulting back to 5.3, when they run a default of 5.4. Thanks so much! Fixed. Commented Jul 30, 2014 at 13:51

1 Answer 1

2

I got the same problem in my linux shared hosting. when I make the default version of php from 5.3 to 5.5 it has been solved properly.

Sign up to request clarification or add additional context in comments.

3 Comments

What file did you have to change the version number in order to get things working or did you have to make the change on the server control panel? I changed my version of php from running 5.3 to 5.4 but still get this problem
its work for me , using site5 shared hosting, it was usgin php 5.3 as defualt after change htaccess and insert AddHandler application/x-httpd-php54 .php it work perfectly
@Dexture could you show us what you did? What do we have to add to the .htaccess? thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.