Giter Site home page Giter Site logo

Comments (8)

tristanjahier avatar tristanjahier commented on June 18, 2024 1

Thank you for your detailed answer @bobthecow! Unfortunately, I think that playing with process forks is a bit out of my skill set. :(

However, if I ever come to spend time on this problem again, I will open an issue or a PR on PsySH's repository.

from tinker.

mfn avatar mfn commented on June 18, 2024

Works for me:

# ./artisan tinker
Psy Shell v0.12.3 (PHP 8.3.4 — cli) by Justin Hileman
> $pdo = new PDO('pgsql:host=pgsql;port=5432;dbname=db', 'user', 'pass');
= PDO {#8460
    inTransaction: false,
    attributes: {
      CASE: NATURAL,
      ERRMODE: EXCEPTION,
      PERSISTENT: false,
      DRIVER_NAME: "pgsql",
      SERVER_INFO: "PID: 226; Client Encoding: UTF8; Is Superuser: on; Session Authorization: db; Date Style: ISO, MDY",
      ORACLE_NULLS: NATURAL,
      CLIENT_VERSION: "13.14",
      SERVER_VERSION: "16.2 (Debian 16.2-1.pgdg120+2)",
      STATEMENT_CLASS: [
        "PDOStatement",
      ],
      EMULATE_PREPARES: false,
      CONNECTION_STATUS: "Connection OK; waiting to send.",
      STRINGIFY_FETCHES: false,
      DEFAULT_FETCH_MODE: BOTH,
    },
  }

pgsql 16 in a docker container, not homebrew

from tinker.

driesvints avatar driesvints commented on June 18, 2024

Thanks @mfn

from tinker.

bobthecow avatar bobthecow commented on June 18, 2024

@tristanjahier if you run tinker with the -vvv flag do you get more information?

from tinker.

tristanjahier avatar tristanjahier commented on June 18, 2024

@tristanjahier if you run tinker with the -vvv flag do you get more information?

I get this output in gray:

return $pdo = new PDO('pgsql:host=127.0.0.1;port=5432;dbname=toto', 'myusername', 'mypassword');

and nothing else.

If the PostgreSQL server is offline, I simply get a normal error when constructing the PDO instance:

PDOException SQLSTATE[08006] [7] connection to server at "127.0.0.1", port 5432 failed: Connection refused
Is the server running on that host and accepting TCP/IP connections?

from tinker.

bobthecow avatar bobthecow commented on June 18, 2024

if you disable process forking (i.e. add 'usePcntl' => false to your PsySH config) does it work?

from tinker.

tristanjahier avatar tristanjahier commented on June 18, 2024

Turning this feature off makes things work again. 🙂👍🏻 Thank you a lot!

I had no problem on my previous computer (with the same PsySH config). The PCNTL extension is enabled. What does it tell? Do I miss a library?

from tinker.

bobthecow avatar bobthecow commented on June 18, 2024

you have reached a fork in the road. you can dig in, to figure out why it's failing, or you can take the win and walk away :P

if it works with process forking off, and doesn't work with it on, it's probably not a missing library. in the past issues like this have been due to bugs in php extensions, linked libraries, or PHP bindings to libraries.

the next step is probably to come up with the smallest piece of code that can reproduce it. i'd guess it's probably something like:

  1. open a Postgres PDO connection
  2. fork
  3. (maybe) use your connection to make a query?

from tinker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.