Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Jeroendebeer's avatar

Error 500 deploying Laravel

Hi!

I try to deploy my laravel 5.7 project. I uploaded my project to my root, but got the following error from apache.

[Wed Oct 17 11:54:17.103377 2018] [:error] [pid 13588] [client 84.56.247.250:6453320] PHP Parse error: syntax error, unexpected '=' in /var/www/example.com/public_html/vendor/laravel/framework/src/Illuminate/Support/Arr.php on line 388

I run php 7.2 on a debian server. Composer install and update didn't return any errors.

UPDATE: Problem was using wrong PHP. I'm not sure if I was using 7.0 or 7.2 but after switching to 7.1 it works.

0 likes
9 replies
munazzil's avatar

@JEROENDEBEER Check your Arr.php on line 388 the additional = has over there i think because syntax error means which we have written code errors.

Jeroendebeer's avatar

This is line 388, 389 and 340:

if (static::accessible($subKeyArray) && static::exists($subKeyArray, $segment)) { $subKeyArray = $subKeyArray[$segment]; }

nothing strange right?

munazzil's avatar

@Jeroendebeer

can you give before that two line of code?

and add as like below.

        if ((static::accessible($subKeyArray)) && (static::exists($subKeyArray, $segment))) 
    
         {
        $subKeyArray = $subKeyArray[$segment];
         }
Jeroendebeer's avatar
public static function has($array, $keys)
{
    if (is_null($keys)) {
        return false;
    }

    $keys = (array) $keys;

    if (! $array) {
        return false;
    }

    if ($keys === []) {
        return false;
    }

    foreach ($keys as $key) {
        $subKeyArray = $array;

        if (static::exists($array, $key)) {
            continue;
        }

        foreach (explode('.', $key) as $segment) {
            if (static::accessible($subKeyArray) && static::exists($subKeyArray, $segment)) {
                $subKeyArray = $subKeyArray[$segment];
            } else {
                return false;
            }
        }
    }

    return true;
}
Jeroendebeer's avatar
Jeroendebeer
OP
Best Answer
Level 1

Problem was using wrong PHP. I'm not sure if I was using 7.0 or 7.2 but after switching to 7.1 it works.

munazzil's avatar

@Jeroendebeer

            you can check your php version in mysql database or in cmd just type php -v 
            and press enter.
Jeroendebeer's avatar

The problem was that I enabled multiple php versions, when I ran php -v it outputed 7.2. After disabling all php versions and enabling 7.1 it all worked.

Please or to participate in this conversation.