2

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

mchev
  • 713
  • 1
  • 8
  • 22
  • 1
    An error in 5xx is always an invitation to visit the error log. Locate the related error message and [edit] your question to add it. – hakre Jul 21 '23 at 05:50
  • 1
    This leaves a bit programming territory and is not particularly a good fit on SO as you need to troubleshoot it. It helps if you share _your_ understanding of those error messages as well, so it is easier to pinpoint the context and provide better commentary if not even an answer. Check the valet pool configuration in php-fpm, it seems you're getting timeouts (see the high number of seconds and SIGABRT), so it looks like as if the valet pool configuration was thrown under the bus. And btw. have you tried to reconfigure? – hakre Jul 21 '23 at 06:11
  • With my limited server management knowledge, I believe that PHP and Valet should be working fine since all other sites (local) using a different 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. – mchev Jul 21 '23 at 06:56
  • 1
    Yes, imagine the protocol changed between 12 and 15.3. Connecting with 15.3 to a 12 server may result in not getting the connection established and either the client or the server is waiting for more data but the other end is not aware of that. Then this "hangs" and then PHP-FPM sees a long running child ("php script") and sends the abort signal. If you need a different PHP configuration (this includes the extensions in use), in PHP-FPM you either have your own PHP-FPM instance (e.g. different PHP version) but at least your own pool with that configuration. I'm not proficient with Valet (1/2) – hakre Jul 21 '23 at 07:21
  • (2/2), but it looks to me that there is only one pool, the one named "valet". This would explain why all applications served from the valet pool have the same postgres versions, it is just that configuration. So while you use that to confirm that valet is working, this looks a bit to me that the (probable) approach of valet as "one size fits it all", while convenient on the get-go, is not fitting any longer where you need to diverge in the configuration of that specific app. But as written, I don't know valet well enough, so double check their docs what your configuration options are. – hakre Jul 21 '23 at 07:25
  • 1
    And forgot to mention: Please [edit] the question and add your understanding after the logs as well. I found your last comment very insightful, and it should not be hidden in comments. A valet user then may already understand your issue and give much more concrete pointers than I can do. – hakre Jul 21 '23 at 10:02
  • i thought i am the only one facing this problem. exactly the same error. is there any solution? – Faytraneozter Jul 23 '23 at 14:02
  • 1
    @Faytraneozter actually i didn't find any solution. I'm working on the project using `php artisan serve` but it is not ideal. I wrote a PM to Marcel Pociot hoping he will take a look. – mchev Jul 24 '23 at 06:59
  • postgresql support is now included, just update the app. PHP 8.3 beta doesn't seem to include it, but the others do. – Elliot Jul 30 '23 at 13:55

1 Answers1

2

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.

mchev
  • 713
  • 1
  • 8
  • 22