inex / birdseye

A Simple Secure Micro Service for Querying Bird (JSON API)
MIT License
46 stars 21 forks source link

Laravel & PHP8 #18

Closed jvobelnet closed 1 year ago

jvobelnet commented 2 years ago

We're moving our current IXPManager setup to a new one, and in the meantime, we're also upgrading the Ubuntu distrib we're running on. So the new server runs on Ubuntu 22.04, which comes with PHP8, and I have errors with birdseye on it.

2022-07-01 11:53:24: (mod_fastcgi.c.451) FastCGI-stderr:PHP Fatal error: During inheritance of ArrayAccess: Uncaught ErrorException: Return type of Illuminate\Http\Request::offsetExists($offset) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /srv/birdseye/vendor/illuminate/http/Request.php:992 2022-07-01 11:53:24: (mod_fastcgi.c.451) FastCGI-stderr:Stack trace: 2022-07-01 11:53:24: (mod_fastcgi.c.451) FastCGI-stderr:0 /srv/birdseye/vendor/illuminate/http/Request.php(16): Laravel\Lumen\Application->Laravel\Lumen\Concerns{closure}() 2022-07-01 11:53:24: (mod_fastcgi.c.451) FastCGI-stderr:1 /srv/birdseye/vendor/composer/ClassLoader.php(444): include('...') 2022-07-01 11:53:24: (mod_fastcgi.c.451) FastCGI-stderr:2 /srv/birdseye/vendor/composer/ClassLoader.php(322): Composer\Autoload\includeFile() 2022-07-01 11:53:24: (mod_fastcgi.c.451) FastCGI-stderr:3 /srv/birdseye/vendor/laravel/lumen-framework/src/Application.php(430): Composer\Autoload\ClassLoader->loadClass() 2022-07-01 11:53:24: (mod_fastcgi.c.451) FastCGI-stderr:4 /srv/birdseye/vendor/illuminate/container/Container.php(731): Laravel\Lumen\Application->Laravel\Lumen{closure}() 2022-07-01 11:53:24: (mod_fastcgi.c.451) FastCGI-stderr:5 /srv/birdseye/vendor/illuminate/container/Container.php(629): Illuminate\Container\Container->build() 2022-07-01 11:53:24: (mod_fastcgi.c.451) FastCGI-stderr:6 /srv/birdseye/vendor/laravel/lumen-framework/src/Application.php(206): Illuminate\Container\Container->make() 2022-07-01 11:53:24: (mod_fastcgi.c.451) FastCGI-stderr:7 /srv/birdseye/vendor/laravel/lumen-framework/src/Routing/UrlGenerator.php(310): Laravel\Lumen\Application->make() 2022-07-01 11:53:24: (mod_fastcgi.c.451) FastCGI-stderr:8 /srv/birdseye/vendor/laravel/lumen-framework/src/Routing/UrlGenerator.php(97): Laravel\Lumen\Routing\UrlGenerator->getRootUrl() 2022-07-01 11:53:24: (mod_fastcgi.c.451) FastCGI-stderr:9 /srv/birdseye/vendor/laravel/lumen-framework/src/helpers.php(311): Laravel\Lumen\Routing\UrlGenerator->to() 2022-07-01 11:53:24: (mod_fastcgi.c.451) FastCGI-stderr:10 /srv/birdseye/app/Http/routes.php(29): url() 2022-07-01 11:53:24: (mod_fastcgi.c.451) FastCGI-stderr:11 /srv/birdseye/bootstrap/app.php(142): require('...') 2022-07-01 11:53:24: (mod_fastcgi.c.451) FastCGI-stderr:12 [internal function]: {closure}() 2022-07-01 11:53:24: (mod_fastcgi.c.451) FastCGI-stderr:13 /srv/birdseye/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(92): call_user_func() 2022-07-01 11:53:24: (mod_fastcgi.c.451) FastCGI-stderr:14 /srv/birdseye/bootstrap/app.php(143): Laravel\Lumen\Application->group() 2022-07-01 11:53:24: (mod_fastcgi.c.451) FastCGI-stderr:15 /srv/birdseye/public/index.php(14): require('...') 2022-07-01 11:53:24: (mod_fastcgi.c.451) FastCGI-stderr:16 {main} in /srv/birdseye/vendor/illuminate/http/Request.php on line 16 2022-07-01 11:53:24: (mod_fastcgi.c.451) FastCGI-stderr:PHP Warning: Uncaught ErrorException: Return type of Illuminate\Http\Request::offsetExists($offset) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /srv/birdseye/vendor/illuminate/http/Request.php:992 2022-07-01 11:53:24: (mod_fastcgi.c.451) FastCGI-stderr:Stack trace: 2022-07-01 11:53:24: (mod_fastcgi.c.451) FastCGI-stderr:0 /srv/birdseye/vendor/composer/ClassLoader.php(444): Laravel\Lumen\Application->Laravel\Lumen\Concerns{closure}() 2022-07-01 11:53:24: (mod_fastcgi.c.451) FastCGI-stderr:1 /srv/birdseye/vendor/composer/ClassLoader.php(444): include() 2022-07-01 11:53:24: (mod_fastcgi.c.451) FastCGI-stderr:2 /srv/birdseye/vendor/composer/ClassLoader.php(322): Composer\Autoload\includeFile() 2022-07-01 11:53:24: (mod_fastcgi.c.451) FastCGI-stderr:3 /srv/birdseye/vendor/laravel/lumen-framework/src/Concerns/RegistersExceptionHandlers.php(67): Composer\Autoload\ClassLoader->loadClass() 2022-07-01 11:53:24: (mod_fastcgi.c.451) FastCGI-stderr:4 /srv/birdseye/vendor/laravel/lumen-framework/src/Concerns/RegistersExceptionHandlers.php(55): Laravel\Lumen\Application->handleShutdown() 2022-07-01 11:53:24: (mod_fastcgi.c.451) FastCGI-stderr:5 [internal function]: Laravel\Lumen\Application->Laravel\Lumen\Concerns{closure}() 2022-07-01 11:53:24: (mod_fastcgi.c.451) FastCGI-stderr:6 {main} 2022-07-01 11:53:24: (mod_fastcgi.c.451) FastCGI-stderr: thrown in /srv/birdseye/vendor/illuminate/http/Request.php on line 992 2022-07-01 11:53:24: (mod_fastcgi.c.451) FastCGI-stderr:PHP Fatal error: During inheritance of ArrayAccess: Uncaught ErrorException: Return type of Illuminate\Http\Request::offsetExists($offset) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /srv/birdseye/vendor/illuminate/http/Request.php:992 2022-07-01 11:53:24: (mod_fastcgi.c.451) FastCGI-stderr:Stack trace: 2022-07-01 11:53:24: (mod_fastcgi.c.451) FastCGI-stderr:0 /srv/birdseye/vendor/illuminate/http/Request.php(16): Laravel\Lumen\Application->Laravel\Lumen\Concerns{closure}() 2022-07-01 11:53:24: (mod_fastcgi.c.451) FastCGI-stderr:1 /srv/birdseye/vendor/composer/ClassLoader.php(444): include('...') 2022-07-01 11:53:24: (mod_fastcgi.c.451) FastCGI-stderr:2 /srv/birdseye/vendor/composer/ClassLoader.php(322): Composer\Autoload\includeFile() 2022-07-01 11:53:24: (mod_fastcgi.c.451) FastCGI-stderr:3 /srv/birdseye/vendor/laravel/lumen-framework/src/Application.php(430): Composer\Autoload\ClassLoader->loadClass() 2022-07-01 11:53:24: (mod_fastcgi.c.451) FastCGI-stderr:4 /srv/birdseye/vendor/illuminate/container/Container.php(731): Laravel\Lumen\Application->Laravel\Lumen{closure}() 2022-07-01 11:53:24: (mod_fastcgi.c.451) FastCGI-stderr:5 /srv/birdseye/vendor/illuminate/container/Container.php(629): Illuminate\Container\Container->build() 2022-07-01 11:53:24: (mod_fastcgi.c.451) FastCGI-stderr:6 /srv/birdseye/vendor/laravel/lumen-framework/src/Application.php(206): Illuminate\Container\Container->make() 2022-07-01 11:53:24: (mod_fastcgi.c.451) FastCGI-stderr:7 /srv/birdseye/vendor/laravel/lumen-framework/src/Routing/UrlGenerator.php(310): Laravel\Lumen\Application->make() 2022-07-01 11:53:24: (mod_fastcgi.c.451) FastCGI-stderr:8 /srv/birdseye/vendor/laravel/lumen-framework/src/Routing/UrlGenerator.php(97): Laravel\Lumen\Routing\UrlGenerator->getRootUrl() 2022-07-01 11:53:24: (mod_fastcgi.c.451) FastCGI-stderr:9 /srv/birdseye/vendor/laravel/lumen-framework/src/helpers.php(311): Laravel\Lumen\Routing\UrlGenerator->to() 2022-07-01 11:53:24: (mod_fastcgi.c.451) FastCGI-stderr:10 /srv/birdseye/app/Http/routes.php(29): url() 2022-07-01 11:53:24: (mod_fastcgi.c.451) FastCGI-stderr:11 /srv/birdseye/bootstrap/app.php(142): require('...') 2022-07-01 11:53:24: (mod_fastcgi.c.451) FastCGI-stderr:12 [internal function]: {closure}() 2022-07-01 11:53:24: (mod_fastcgi.c.451) FastCGI-stderr:13 /srv/birdseye/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(92): call_user_func() 2022-07-01 11:53:24: (mod_fastcgi.c.451) FastCGI-stderr:14 /srv/birdseye/bootstrap/app.php(143): Laravel\Lumen\Application->group() 2022-07-01 11:53:24: (mod_fastcgi.c.451) FastCGI-stderr:15 /srv/birdseye/public/index.php(14): require('...') 2022-07-01 11:53:24: (mod_fastcgi.c.451) FastCGI-stderr:16 {main} in /srv/birdseye/vendor/illuminate/http/Request.php on line 16

I was able to setup PHP7.4 on the server and everything is running fine, but I'd suggest to make this compatible with PHP8. From what I understand, we need Laravel >6, but it's currently delivered with Laravel 5.x (see https://blog.laravel.com/laravel-php-8-support).

pashdown commented 1 year ago

PHP8.1 and 22.04 compatibility would be appreciated.

barryo commented 1 year ago

Hey @pashdown - checkout this branch https://github.com/inex/birdseye/tree/php81

Haven't had a chance to turn it into a release yet but works fine for us

rlaager commented 1 year ago

That gets me past the errors, and it is fine with CACHE_DRIVER=file, but with CACHE_DRIVER=memcached, I get an application level 500 error page:

Oops! An Error Occurred The server returned a "500 Internal Server Error". Something is broken. Please let us know what you were doing when this error occurred. We will fix it as soon as possible. Sorry for any inconvenience caused.

This is Ubuntu 22.04: PHP 8.1.2-1ubuntu2.11 (cli) (built: Feb 22 2023 22:56:18) (NTS) Copyright (c) The PHP Group Zend Engine v4.1.2, Copyright (c) Zend Technologies with Zend OPcache v8.1.2-1ubuntu2.11, Copyright (c), by Zend Technologies

I'm not sure if I should care about using memcached.

barryo commented 1 year ago

I use file usually for this. You'll need to install php-memcahed for memcache support if I recall correctly.