Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

why does PHP DB 127.0.0.1 works , but localhost doesn't work

2»

Comments

  • xTomxTom Member, Patron Provider
    sed -i 's/#precedence ::ffff:0:0\/96  100/precedence ::ffff:0:0\/96  100/' /etc/gai.conf
    

    try to make IPv4 prefer

  • actually , I sorted it out after set up another server to compare , even checked with my previous centos7/almalinux8 setup

    it was my stupid mistake , I placed a sandbox-like env for PHP process(es) , where it was working on centos , the path was /var/lib/mysql/mysql.sock but after I migrated to ubuntu , the PHP mysql default path changed to /var/run/mysqld/mysql.sock but I did not update the sandbox setting accordingly

    so "localhost" failed to find the path , that explains why if I use 127.0.0.1 works as it goes though TCP/IP , or localhost:/run/mysqld/mysqld.sock to specify the socket path , while localhost on ubuntu php it defaults to /var/run/mysqld/mysql.sock and failed to access to it

    thanks for all the help I have received , really appreciated

    Thanked by 11q1
  • @1q1 said: sure enough, your MySQL is not binding to IPv6.

    https://lowendtalk.com/discussion/comment/3561346/#Comment_3561346
    Seems like IPv6 is there.

    Thanked by 11q1
  • @qtwrk said: PHP mysql default

    PHP log didnt say anything about failed connection?

  • @1q1 said:

    @qtwrk said: PHP mysql default

    PHP log didnt say anything about failed connection?

    I remember it only says failed to fetch some file, but didn't specify what path it tried, that's what took me so long to dig it out :)

  • 1q11q1 Member
    edited December 2022

    @qtwrk said: took me so long to dig it out :)

    damn wp. too much spoonfeeding us with conveniences and optimizations

Sign In or Register to comment.