laravel / sail

Docker files for running a basic Laravel application.
https://laravel.com/docs/sail
MIT License
1.65k stars 470 forks source link

fix: fixed swoole extension that gets the SQLSTATE[08006] error #715

Closed pedrovian4 closed 1 week ago

pedrovian4 commented 1 month ago

Description

While working on my server, I encountered the errorSQLSTATE[08006], which is caused by the Swoole extension installed through the PPA. To resolve this issue, I reinstalled Swoole using PECL, which resolved the connection problem.

My reference to solve the problem: https://stackoverflow.com/questions/78669556/possible-bug-with-php-pdo-and-with-postgresql

image

taylorotwell commented 1 month ago

Will need more community feedback and confirmation.

renky commented 3 weeks ago

Edit: (removed my first confirming answer):

I didn't get it finally running with this solution. This solution fixes the current problem with running NON-swoole environments - but for that you can also just omit the swoole installation.

To use swoole this solution seems not to be enough because the extension is not enabled after installation with pecl. You still have to add extension=swoole.so to the php.ini Finally I also didn't get it work. I had to manually root-bash into the app container, run pecl install swool-5.1.2 manually (confirming all questions) and finally add extension=swoole.so to the php.ini - after a manual restart my swoole sail environment worked fine...

If anybody gets it running out of the box, I appreciate the solution...

In the end, it seems to be only a temporary hiccup. swoole already fixed this issue here: https://github.com/swoole/swoole-src/pull/5396 nevertheless, there is currently no new version available and finally it still has to be taken into php-swoole binaries what will for sure take some more time. But finally if we just wait 1-2 months the issue might be solved without changing the sail Dockerfile - until then, everybody using sail has either to uninstall php8.x-swoole or install it manually and activate the extension.

beNjiox commented 3 weeks ago

Had the same issue and just found out this thread.

Doing sudo rm /etc/php/8.3/mods-available/swoole.ini solve my problem.

Found out thanks to this stack overflow issue https://stackoverflow.com/questions/78669556/possible-bug-with-php-pdo-and-with-postgresql

Step to reproduce the issue (basically my use case)

pedrovian4 commented 3 weeks ago

Had the same issue and just found out this thread.

Doing sudo rm /etc/php/8.3/mods-available/swoole.ini solve my problem.

Found out thanks to this stack overflow issue https://stackoverflow.com/questions/78669556/possible-bug-with-php-pdo-and-with-postgresql

Step to reproduce the issue (basically my use case)

* one managed database from digitalocean

* fresh laravel app, pointing to the database

* lauching the app and seeing : "could not send SSL negotiation packet"

Oh nice, I will add this to the PR, I did not get this error even using swoole on my service

renky commented 2 weeks ago

I can confirm, after the last change it works fine with octane environments !!

EduardoCerutti commented 2 weeks ago

This solution worked very well for me

taylorotwell commented 1 week ago

But why are we permanently pinning a specific version of Swoole here?

pedrovian4 commented 1 week ago

But why are we permanently pinning a specific version of Swoole here?

Because the version of swoole in the apt repository is 6.0.0 that is in alpha, and that still got bugs, so the solution was to downgrade the swoole to get the LTS