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.
@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.
This is line 388, 389 and 340:
if (static::accessible($subKeyArray) && static::exists($subKeyArray, $segment)) {
$subKeyArray = $subKeyArray[$segment];
}
nothing strange right?
@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];
}
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;
}
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.
@Jeroendebeer
you can check your php version in mysql database or in cmd just type php -v
and press enter.
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.
@Jeroendebeer
From What directory should i put my .htaccess file?
Please sign in or create an account to participate in this conversation.