-
Notifications
You must be signed in to change notification settings - Fork 119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
php artisan opcache:compile exception #123
Comments
See #122. Some of the symfony polyfills contain union types, which are compatible only with PHP8. |
@mauricius Thanks, it solved the issue. |
Followed the way provided in #122 , but it didn't work. Does anyone have any ideas?
Laravel 8 |
The problem still remains. Laravel 8.45.1 This does not help: 'exclude' => [ |
The following works for me in Laravel 8.47
If you still have issues you can try to exclude the entire symfony folder:
|
@mauricius Please see the comment |
I ran into this issue yesterday. We're running Laravel 8 on PHP7.4. What I discovered is that Doctrine/Common contains PHP8 code. Specifically Within your I thought it might be helpful to document how I found this because the thrown exception is not immediately helpful. When the exception occurs, it points to line 258 of public function toException()
{
if ($this->failed()) {
return new RequestException($this); < Go into RequestException.
}
} Within Up this number, rerun Hope that helps. UPDATE: You can add 'exclude' => [
'symfony/console/Attribute',
'symfony/event-dispatcher/Attribute',
'symfony/polyfill-ctype', // bootstrap80.php is the offender here. Can't seem to exclude files. Only folders. This follows all the way down to symfony/polyfill-php80
'symfony/polyfill-iconv',
'symfony/polyfill-intl-grapheme',
'symfony/polyfill-intl-idn',
'symfony/polyfill-intl-normalizer',
'symfony/polyfill-mbstring',
'symfony/polyfill-php80',
'symfony/service-contracts/Attribute',
'Doctrine/Common/Cache/Psr6',
], |
@markkasaboski Unfortunately, it didn't help |
@php-writerman See the line "ParseError: syntax error, unexpected identifier "enum" in file (truncated)"? You need to untruncate this line in order to see the rest of the error message. Once you can see the full error message, you will find the file, and therefore, the package with the offending code. What I described above will help you pinpoint the file. Go into $summary = class_exists(\GuzzleHttp\Psr7\Message::class)
? \GuzzleHttp\Psr7\Message::bodySummary($response->toPsrResponse())
: \GuzzleHttp\Psr7\get_message_body_summary($response->toPsrResponse()); Both of those functions take an integer as a second argument. Assuming your installation does have $summary = class_exists(\GuzzleHttp\Psr7\Message::class)
? \GuzzleHttp\Psr7\Message::bodySummary($response->toPsrResponse(), 50000)
: \GuzzleHttp\Psr7\get_message_body_summary($response->toPsrResponse()); Otherwise add Rerun compile and dig through that output for the file that's producing the error. If you're not sure what to look for, paste it here and I'll take a look. This may happen several times until you've excluded all of the offenders. |
@markkasaboski Thanks a lot! The problem was in some package. I excluded it and now it works. |
Hi, I have same quesiton too, but I solved it. Maybe you can try set
Then execute Just for Docker (Nginx proxy to Apache) |
Nope. $ php8.1 artisan opcache:compile --force
Compiling scripts...
Illuminate\Http\Client\RequestException
HTTP request returned status code 404:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width= (truncated...)
at vendor/laravel/framework/src/Illuminate/Http/Client/Response.php:288
284▕ */
285▕ public function toException()
286▕ {
287▕ if ($this->failed()) {
➜ 288▕ return new RequestException($this);
289▕ }
290▕ }
291▕
292▕ /**
+15 vendor frames
16 artisan:37
Illuminate\Foundation\Console\Kernel::handle() So it still aren't resolution. |
More info for debugging that issue.
and get:
|
Running php artisan opcache:compile I receive:
`ParseError: syntax error, unexpected '|', expecting variable (T_VARIABLE) (truncated...)
at vendor/laravel/framework/src/Illuminate/Http/Client/Response.php:241
237▕ {
238▕ $callback = func_get_args()[0] ?? null;
239▕
240▕ if ($this->failed()) {
➜ 241▕ throw tap(new RequestException($this), function ($exception) use ($callback) {
242▕ if ($callback && is_callable($callback)) {
243▕ $callback($this, $exception);
244▕ }
245▕ });
`
Laravel 8.22.1
PHP 7.4.14
The text was updated successfully, but these errors were encountered: