The-NeXT-Project / NeXT-Panel

Next generation proxy service management system (OSS Edition)
https://nextpanel.dev
GNU General Public License v3.0
167 stars 39 forks source link

[BUG] Redis连接语法有误 ( Redis::__construct() expects exactly 0 arguments, 1 given) #64

Closed wuyifan66 closed 4 months ago

wuyifan66 commented 4 months ago

Environment 环境

OS: RedHat Linux Enterprise 9 HTTPS enabled: yes PHP version: 8.2 DB version: marindb 11.2 Redis version: 7.2 Commit: 24.5.1

Bug Info

Describe the issue you run into. 请描述你遇到的问题。

对接.NEXT Server 时报错

报错提示Redis连接语法有误。 Redis::__construct() expects exactly 0 arguments, 1 given

<!doctype html> Slim Application Error

Slim Application Error

The application could not run because of the following error:

Details

Type: ArgumentCountError
Code: 0
Message: Redis::construct() expects exactly 0 arguments, 1 given
File: /www/wwwroot/NEXT/src/Services/Cache.php
Line: 13

Trace

#0 /www/wwwroot/NEXT/src/Services/Cache.php(13): Redis->construct()

1 /www/wwwroot/NEXT/src/Services/RateLimit.php(19): App\Services\Cache->initRedis()

2 /www/wwwroot/NEXT/src/Middleware/NodeToken.php(36): App\Services\RateLimit->__construct()

3 /www/wwwroot/NEXT/vendor/slim/slim/Slim/MiddlewareDispatcher.php(129): App\Middleware\NodeToken->process()

4 /www/wwwroot/NEXT/vendor/slim/slim/Slim/MiddlewareDispatcher.php(73): Psr\Http\Server\RequestHandlerInterface@anonymous->handle()

5 /www/wwwroot/NEXT/vendor/slim/slim/Slim/Routing/Route.php(321): Slim\MiddlewareDispatcher->handle()

6 /www/wwwroot/NEXT/vendor/slim/slim/Slim/Routing/RouteRunner.php(74): Slim\Routing\Route->run()

7 /www/wwwroot/NEXT/src/Middleware/ErrorHandler.php(44): Slim\Routing\RouteRunner->handle()

8 /www/wwwroot/NEXT/vendor/slim/slim/Slim/MiddlewareDispatcher.php(129): App\Middleware\ErrorHandler->process()

9 /www/wwwroot/NEXT/vendor/slim/slim/Slim/MiddlewareDispatcher.php(73): Psr\Http\Server\RequestHandlerInterface@anonymous->handle()

10 /www/wwwroot/NEXT/vendor/slim/slim/Slim/App.php(209): Slim\MiddlewareDispatcher->handle()

11 /www/wwwroot/NEXT/vendor/slim/slim/Slim/App.php(193): Slim\App->handle()

12 /www/wwwroot/NEXT/public/index.php(40): Slim\App->run()

wuyifan66 commented 4 months ago
[root@localhost nextserver]# ./next-server
NeXT-Server 0.3.2 (Next generation proxy server)
2024/07/02 03:53:41 Start the panel..
2024/07/02 03:53:41 Xray Core Version: 1.8.16
2024/07/02 03:53:41 [Warning] core: Xray 1.8.16 started
2024/07/02 03:53:41 Panel Start failed: request https://**server_hide**/mod_mu/nodes/1/info failed: <!doctype html><html lang="en">    <head>        <meta charset="utf-8">        <meta name="viewport" content="width=device-width, initial-scale=1">        <title>Slim Application Error</title>        <style>            body{margin:0;padding:30px;font:12px/1.5 Helvetica,Arial,Verdana,sans-serif}            h1{margin:0;font-size:48px;font-weight:normal;line-height:48px}            strong{display:inline-block;width:65px}        </style>    </head>    <body>        <h1>Slim Application Error</h1>        <div><p>The application could not run because of the following error:</p><h2>Details</h2><div><strong>Type:</strong> ArgumentCountError</div><div><strong>Code:</strong> 0</div><div><strong>Message:</strong> Redis::__construct() expects exactly 0 arguments, 1 given</div><div><strong>File:</strong> /www/wwwroot/NEXT/src/Services/Cache.php</div><div><strong>Line:</strong> 13</div><h2>Trace</h2><pre>#0 /www/wwwroot/NEXT/src/Services/Cache.php(13): Redis-&gt;__construct()
#1 /www/wwwroot/NEXT/src/Services/RateLimit.php(19): App\Services\Cache-&gt;initRedis()
#2 /www/wwwroot/NEXT/src/Middleware/NodeToken.php(36): App\Services\RateLimit-&gt;__construct()
#3 /www/wwwroot/NEXT/vendor/slim/slim/Slim/MiddlewareDispatcher.php(129): App\Middleware\NodeToken-&gt;process()
#4 /www/wwwroot/NEXT/vendor/slim/slim/Slim/MiddlewareDispatcher.php(73): Psr\Http\Server\RequestHandlerInterface@anonymous-&gt;handle()
#5 /www/wwwroot/NEXT/vendor/slim/slim/Slim/Routing/Route.php(321): Slim\MiddlewareDispatcher-&gt;handle()
#6 /www/wwwroot/NEXT/vendor/slim/slim/Slim/Routing/RouteRunner.php(74): Slim\Routing\Route-&gt;run()
#7 /www/wwwroot/NEXT/src/Middleware/ErrorHandler.php(44): Slim\Routing\RouteRunner-&gt;handle()
#8 /www/wwwroot/NEXT/vendor/slim/slim/Slim/MiddlewareDispatcher.php(129): App\Middleware\ErrorHandler-&gt;process()
#9 /www/wwwroot/NEXT/vendor/slim/slim/Slim/MiddlewareDispatcher.php(73): Psr\Http\Server\RequestHandlerInterface@anonymous-&gt;handle()
#10 /www/wwwroot/NEXT/vendor/slim/slim/Slim/App.php(209): Slim\MiddlewareDispatcher-&gt;handle()
#11 /www/wwwroot/NEXT/vendor/slim/slim/Slim/App.php(193): Slim\App-&gt;handle()
#12 /www/wwwroot/NEXT/public/index.php(40): Slim\App-&gt;run()
#13 {main}</pre></div>        <a href="#" onclick="window.history.go(-1)">Go Back</a>    </body></html>, <nil>
panic: Panel Start failed: request https://**server_hide**/mod_mu/nodes/1/info failed: <!doctype html><html lang="en">    <head>        <meta charset="utf-8">        <meta name="viewport" content="width=device-width, initial-scale=1">        <title>Slim Application Error</title>        <style>            body{margin:0;padding:30px;font:12px/1.5 Helvetica,Arial,Verdana,sans-serif}            h1{margin:0;font-size:48px;font-weight:normal;line-height:48px}            strong{display:inline-block;width:65px}        </style>    </head>    <body>        <h1>Slim Application Error</h1>        <div><p>The application could not run because of the following error:</p><h2>Details</h2><div><strong>Type:</strong> ArgumentCountError</div><div><strong>Code:</strong> 0</div><div><strong>Message:</strong> Redis::__construct() expects exactly 0 arguments, 1 given</div><div><strong>File:</strong> /www/wwwroot/NEXT/src/Services/Cache.php</div><div><strong>Line:</strong> 13</div><h2>Trace</h2><pre>#0 /www/wwwroot/NEXT/src/Services/Cache.php(13): Redis-&gt;__construct()
#1 /www/wwwroot/NEXT/src/Services/RateLimit.php(19): App\Services\Cache-&gt;initRedis()
#2 /www/wwwroot/NEXT/src/Middleware/NodeToken.php(36): App\Services\RateLimit-&gt;__construct()
#3 /www/wwwroot/NEXT/vendor/slim/slim/Slim/MiddlewareDispatcher.php(129): App\Middleware\NodeToken-&gt;process()
#4 /www/wwwroot/NEXT/vendor/slim/slim/Slim/MiddlewareDispatcher.php(73): Psr\Http\Server\RequestHandlerInterface@anonymous-&gt;handle()
#5 /www/wwwroot/NEXT/vendor/slim/slim/Slim/Routing/Route.php(321): Slim\MiddlewareDispatcher-&gt;handle()
#6 /www/wwwroot/NEXT/vendor/slim/slim/Slim/Routing/RouteRunner.php(74): Slim\Routing\Route-&gt;run()
#7 /www/wwwroot/NEXT/src/Middleware/ErrorHandler.php(44): Slim\Routing\RouteRunner-&gt;handle()
#8 /www/wwwroot/NEXT/vendor/slim/slim/Slim/MiddlewareDispatcher.php(129): App\Middleware\ErrorHandler-&gt;process()
#9 /www/wwwroot/NEXT/vendor/slim/slim/Slim/MiddlewareDispatcher.php(73): Psr\Http\Server\RequestHandlerInterface@anonymous-&gt;handle()
#10 /www/wwwroot/NEXT/vendor/slim/slim/Slim/App.php(209): Slim\MiddlewareDispatcher-&gt;handle()
#11 /www/wwwroot/NEXT/vendor/slim/slim/Slim/App.php(193): Slim\App-&gt;handle()
#12 /www/wwwroot/NEXT/public/index.php(40): Slim\App-&gt;run()
#13 {main}</pre></div>        <a href="#" onclick="window.history.go(-1)">Go Back</a>    </body></html>, `<nil>`

goroutine 1 [running]:
log.Panicf({0x3d40983?, 0x4247730?}, {0xc0010bf9a8?, 0xc0000d3140?, 0x3461440?})
        log/log.go:439 +0x65
github.com/SSPanel-NeXT/NeXT-Server/panel.(*Panel).Start(0xc000efa880)
        github.com/SSPanel-NeXT/NeXT-Server/panel/panel.go:207 +0x4a7
github.com/SSPanel-NeXT/NeXT-Server/cmd.run()
        github.com/SSPanel-NeXT/NeXT-Server/cmd/root.go:97 +0x239
github.com/SSPanel-NeXT/NeXT-Server/cmd.init.func1(0xc000e85700?, {0x3d14f61?, 0x4?, 0x3d14e31?})
        github.com/SSPanel-NeXT/NeXT-Server/cmd/root.go:26 +0x13
github.com/spf13/cobra.(*Command).execute(0x6b467e0, {0xc000070090, 0x0, 0x0})
        github.com/spf13/cobra@v1.8.1/command.go:989 +0xab1
github.com/spf13/cobra.(*Command).ExecuteC(0x6b467e0)
        github.com/spf13/cobra@v1.8.1/command.go:1117 +0x3ff
github.com/spf13/cobra.(*Command).Execute(...)
        github.com/spf13/cobra@v1.8.1/command.go:1041
github.com/SSPanel-NeXT/NeXT-Server/cmd.Execute(...)
        github.com/SSPanel-NeXT/NeXT-Server/cmd/root.go:111
main.main()
        github.com/SSPanel-NeXT/NeXT-Server/main.go:32 +0x1da
AutisticShark commented 4 months ago

PHP Redis extension 6.0+