appstract / laravel-opcache

Laravel Package for OPcache
MIT License
1.33k stars 118 forks source link

HTTP Request 404 Error #119

Open PiwanSama opened 3 years ago

PiwanSama commented 3 years ago

I just installed opcache and get the following error when I to run:

 HTTP request returned status code 404:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found (truncated...)

  at C:\wamp64\www\BeautyGo\vendor\laravel\framework\src\Illuminate\Http\Client\Response.php:231
    227▕     {
    228▕         $callback = func_get_args()[0] ?? null;
    229▕
    230▕         if ($this->failed()) {
  ➜ 231▕             throw tap(new RequestException($this), function ($exception) use ($callback) {
    232▕                 if ($callback && is_callable($callback)) {
    233▕                     $callback($this, $exception);
    234▕                 }
    235▕             });

  1   C:\wamp64\www\BeautyGo\vendor\appstract\laravel-opcache\src\Commands\Clear.php:34
      Illuminate\Http\Client\Response::throw()

  2   C:\wamp64\www\BeautyGo\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:37
      Appstract\Opcache\Commands\Clear::handle()

I'm using:

JesterIruka commented 3 years ago

Same problem here, but status code 403

gbrits commented 3 years ago

Same issue here:


Configuration cache cleared!
Configuration cached successfully!

   Illuminate\Http\Client\RequestException 

  HTTP request returned status code 404.

  at vendor/laravel/framework/src/Illuminate/Http/Client/Response.php:207
    203|      */
    204|     public function throw()
    205|     {
    206|         if ($this->serverError() || $this->clientError()) {
  > 207|             throw new RequestException($this);
    208|         }
    209| 
    210|         return $this;
    211|     }

      [2m+14 vendor frames [22m
  15  artisan:37
      Illuminate\Foundation\Console\Kernel::handle()
JesterIruka commented 3 years ago

I solved the 403 (It was cloudflare issue) but I still with 404, I just gave up at this point

valascus commented 3 years ago

Same issue here (404) Works for localhost tho, but in production, with the APP_URL correct, it doesn't.

anyforever commented 3 years ago

ME TOO.Ver:3.2.1

php artisan opcache:clear

The requested URL returned error: 404 Not Found Url: https://domain/opcache-api/clear?key=eyJpdiI6ImtaV3FMbys0TmZjYjNLM0RwUG9vaFE9PSIsInZhbHVlIjoiK3RyNGFRbk8zZWZ6dXJRcWdRTHFKZz09IiwibWFjIjoiNzUwZjVhZDg2MTA5NDVhMGY5YTcyYWZiZmRhZGJiMTVhOThiM2E1NTE5MGJlM2FhZGZiZWU5OWY3YjE4MWIzYSJ9

miraries commented 3 years ago

I had no issues with opcache:clear, but did get a a 500 on opcache:compile with the following error: ParseError: syntax error, unexpected '|', expecting '{' in file /var/www /var/www (truncated...)

In case someone has a similar problem, I traced it down to symfony/polyfill-intl-idn and other polyfills. Seems like it was loading it's bootstrap80.php files instead of bootstrap.php despite PHP_VERSION_ID being under 80000. For now I'm just using local forks which don't have the bootstrap80.php files but should probably investigate further.

anyforever commented 3 years ago

$ php artisan vendor:publish --provider="Appstract\Opcache\OpcacheServiceProvider" --tag="config" Copied File [\vendor\appstract\laravel-opcache\config\opcache.php] To [\config\opcache.php] Publishing complete. and set 'verify_ssl' => false, 'verify_host' => 0, // 0 for disabled

It's working well.

bmstanley commented 3 years ago

@anyforever I tried to apply these settings to my project and it had no effect. I am running PHP 7.4.13 on Ubuntu 18.04

lorenzocattaneo commented 3 years ago

@miraries check my answer here: https://github.com/appstract/laravel-opcache/issues/122#issuecomment-759400723 It may be an easier solution than keeping forks up to date.

miraries commented 3 years ago

@lorenzocattaneo much better, thanks!

d3vr commented 3 years ago

In my case it was cached routes, so just run:

php artisan route:clear

or

php artisan optimize:clear
ctf0 commented 3 years ago

503 in here


   Illuminate\Http\Client\RequestException 

  HTTP request returned status code 503:
<!DOCTYPE HTML>
<html lang="en-US">
<head>
  <meta charset="UTF-8" />
  <meta http-equiv="Content-Type" content="text/ht (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▕             });

      +14 vendor frames 
  15  artisan:37
      Illuminate\Foundation\Console\Kernel::handle()
darkguy2008 commented 3 years ago

Same here, any updates?

s4m4n commented 3 years ago

Same here. 404

JeffGepiga commented 3 years ago

same issue here, any updates?

vlados commented 3 years ago

$ php artisan vendor:publish --provider="Appstract\Opcache\OpcacheServiceProvider" --tag="config" Copied File [\vendor\appstract\laravel-opcache\config\opcache.php] To [\config\opcache.php] Publishing complete. and set 'verify_ssl' => false, 'verify_host' => 0, // 0 for disabled

It's working well.

As mentioned add this to the config, then clear any cached config with php artisan optimize and then try to recompile the opcache

hefengbao commented 3 years ago
php artisan config:cache
php artisan rotue:cache
songliqiangcn commented 2 years ago

Same issue here:

In Response.php line 260:

  HTTP request returned status code 404:
  <!DOCTYPE html>
  <html lang="en">
  <head>
      <meta charset="utf-8">
      <meta name="viewport" content="width=device-width (truncated...)

Tried below still doesn't work

$ php artisan vendor:publish --provider="Appstract\Opcache\OpcacheServiceProvider" --tag="config" Copied File [\vendor\appstract\laravel-opcache\config\opcache.php] To [\config\opcache.php] Publishing complete.
and set
'verify_ssl' => false, 'verify_host' => 0, // 0 for disabled

Laravel Framework 8.55.0 PHP 7.4.3 nginx version: nginx/1.18.0 (Ubuntu)

gjm commented 2 years ago

I'm also having this issue...

In my local machine everything works fine. In production server I get 404.

My server is behind a load balancer so I'm using http://localhost as OPCACHE_URL. If I try to get any other url, using wget, I get the correct status. But if I try to access /opcache-api/* I get 404.

I've tried clearing cache, routes, config, etc... No luck...

I've tried setting 'verify_ssl' => false in config/opcache.php. Still no luck...

I'm stuck... Anyone has any ideas?

vlados commented 2 years ago

did you try clear cache and config? Are you getting 404 or 500? Look at error logs when you try to compile

muhdfaiz commented 2 years ago

Same issue here. Anyone found the solution?

I'm using Laravel 8 and PHP 8.1.

delejt commented 2 years ago

Hi For 404 - Make sure your APP_URL is set correctly in .env. For 503 - use anyforever solution

anyforever commented 2 years ago

Please clear your php code opcache use other methods, or restart your php-fpm. Because your php code opcache data is created. So the new router ( opcache-api/clear ) can't find. @bmstanley @darkguy2008 @s4m4n @theonly27 @gjm @muhdfaiz @vlados @delejt

YounessTayer commented 1 year ago

I solved this problem by upgrading my laravel installer to version 4, I did it by simply running the following command line :

composer global require "laravel/installer:^4.0"

Thanks for master Elias MISSAOUI who suggested to me this solution.

tranvanhieu01012002 commented 3 months ago
 Illuminate\Http\Client\RequestException 

  HTTP request returned status code 404:
<!DOCTYPE html><html id="__next_error__"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, (truncated...)

  at vendor/laravel/framework/src/Illuminate/Http/Client/Response.php:272
    268▕      */
    269▕     public function toException()
    270▕     {
    271▕         if ($this->failed()) {
  ➜ 272▕             return new RequestException($this);
    273▕         }
    274▕     }
    275▕ 
    276▕     /**

      +14 vendor frames 

This is my error, and I updated ``APP_URL=http://localhostto correct url ->APP_URL=http://localhost:8000```