Search code examples
phplaravelpostgresqlnginxvalet

502 after installing Herd and going back to Valet


I was excited to try the just released Laravel Herd (https://herd.laravel.com) so i didn't read that there wasn't the pdo_pgsql extension inside (and we can't add it manually).

So i launch it, nothing works on apps with postgresql databases.

I'm going back to valet. Removing Herd properly (https://herd.laravel.com/docs/1/troubleshooting/uninstalling) and to be sure run a valet install again.

Well since that i got a 502 Bad Gateway on each app that use postgresql. If i go to Dbgnin and turn off the db i got an actual laravel error that says it can't connect.


Valet nginx log :

[error] 11752#0: *91 upstream prematurely closed connection while reading response header from upstream, client: 127.0.0.1, server: , request: "POST /login HTTP/1.1"

php-fpm log :

[21-Jul-2023 08:02:46] WARNING: [pool valet] child 14476 exited on signal 6 (SIGABRT) after 216.252544 seconds from start
[21-Jul-2023 08:02:46] NOTICE: [pool valet] child 14518 started

With my limited server management knowledge, I believe that PHP and Valet should be working fine since all other sites (local) using a Mysql or Sqlite database are functioning correctly. My concern lies with Postgresql and the PHP extensions. For this specific case, I need to use version 12 of Postgresql. However, when I check the phpinfo, I notice that the extensions pdo_pgsql and pgsql are in version 15.3. Could there be a conflict, and if so, I can't find any way to downgrade the extension versions.

What i tried so far :

  • to reinstall php and pdo_pgsql and pgsql
  • to install posgresql separataly
  • to use a mysql db to try if it work on this project (yes)
  • totaly reinstall php, nginx, upgrading brew, composer, etc.
  • pdo_pgsql and pgsql extensions enabled (version 15.3)

The good news is that i can work on my laravel projects using php artisan serve. But with the good old Valet i can't.

Thanks for any idea


Solution

  • Since they just released a new version with Postgresql support it is now working very well.

    https://twitter.com/marcelpociot/status/1683462872007954435

    New extension: @laravelphp Herd now comes with Postgresql support 🎉 Just update the PHP version via the "Settings" screen.

    But for the record, I've never been able to get my valet sites working properly again with postgresql.