搭建Flarum一切成功但是測試郵箱、註冊時顯示糟糕出錯啦(解決辦法)

hack747發表於2024-08-13

php8.2,php8.3使用者安裝flarum注意關閉display_errors!

不管是註冊(實際註冊成功但報錯),還是SMTP郵件配置測試傳送,以及一系列類似下面這種200報錯的奇怪問題

`POST https://xxxxxxxxxx/register

<br />
<b>Deprecated</b>: json_decode(): Passing null to parameter #1 ($json) of type string is deprecated in <b>/www/wwwroot/inter-knot.com/vendor/fof/doorman/src/Listeners/ValidateDoorkey.php</b> on line <b>43</b><br />
<br />
<b>Fatal error</b>: Uncaught Laminas\HttpHandlerRunner\Exception\EmitterException: Output has been emitted previously; cannot emit response in /www/wwwroot/inter-knot.com/vendor/laminas/laminas-httphandlerrunner/src/Exception/EmitterException.php:20
Stack trace:
#0 /www/wwwroot/inter-knot.com/vendor/laminas/laminas-httphandlerrunner/src/Emitter/SapiEmitterTrait.php(42): Laminas\HttpHandlerRunner\Exception\EmitterException::forOutputSent()
#1 /www/wwwroot/inter-knot.com/vendor/laminas/laminas-httphandlerrunner/src/Emitter/SapiEmitter.php(21): Laminas\HttpHandlerRunner\Emitter\SapiEmitter->assertNoPreviousOutput()
#2 /www/wwwroot/inter-knot.com/vendor/laminas/laminas-httphandlerrunner/src/RequestHandlerRunner.php(75): Laminas\HttpHandlerRunner\Emitter\SapiEmitter->emit()
#3 /www/wwwroot/inter-knot.com/vendor/flarum/core/src/Http/Server.php(45): Laminas\HttpHandlerRunner\RequestHandlerRunner->run()
#4 /www/wwwroot/inter-knot.com/public/index.php(26): Flarum\Http\Server->listen()
#5 {main}
thrown in <b>/www/wwwroot/inter-knot.com/vendor/laminas/laminas-httphandlerrunner/src/Exception/EmitterException.php</b> on line <b>20</b><br />
`

記住關閉php display_errors!【建議加入安裝教程】特殊說明。查了一早上查不到類似報錯,就記得好像是個常見問題,但是又一下反應不過來哪裡有問題。想了半天想起來了,以寶塔舉例,去軟體商店-以安裝軟體,php-設定,配置修改,關閉display_errors即可如圖:


然後SMTP就不會“糟糕,出錯啦”

相關文章