Loading ...
Sorry, an error occurred while loading the content.

Re: [TTLUG] php mysql.sock problems

Expand Messages
  • Richard Hamel-Smith
    ... I am by no means a PHP expert, but I seem to remember that when installing PHP, there is a song-and-dance about re-compiling Apache to take cognisance of
    Message 1 of 3 , May 31, 2004
    • 0 Attachment
      Vidyaratha Kissoon wrote:
      > Hi all,
      > I am now mucking around with apache/mysql/php on my machine.
      > Have apache running, I have mysqld running - I could connect to the
      > server and create databases and so on from the command line. PHP4.3.6
      > is also good - configured --with-msyql etc.
      >
      > When I run my first php scripts to connect - i get the error
      > mysql_connect(): Can't connect to local MySQL server through socket
      > '/tmp/mysql.sock' (2)
      >
      > I don't have mysql.sock anywhere.. could anyone help ?
      > Thanks
      > Vidya
      >

      I am by no means a PHP expert, but I seem to remember that when
      installing PHP, there is a song-and-dance about re-compiling Apache to
      take cognisance of the PHP installation. It was a kind of lock-step sort
      of thing. You did compile from source, right?

      I mention this becoz it was kinda unusual, so it sticks out in my mind.
      It wasn't the normal 'configure-make-make install' scenario, I mean.
      There was a point where I had to stop installing PHP, then go to do
      something to Apache and then come back to finish installing PHP.

      Anybody else have any input on this one?

      Richard
    • Christian Anton
      ... Hash: SHA1 Vidya, I had this problem a while aback. Check mysql.conf for the location of the socket file. Then I believe you can edit conf.php to look
      Message 2 of 3 , Jun 1, 2004
      • 0 Attachment
        -----BEGIN PGP SIGNED MESSAGE-----
        Hash: SHA1

        Vidya,

        I had this problem a while aback. Check mysql.conf for the location of the socket file.
        Then I believe you can edit conf.php to look there. Also, check your file permissions, make 'em more open if you need to, and double check who you're logging into the db as in your PHP script. If all else fails, bypass sockets and use ports; try connecting through 'localhost'.

        Oh and as a security tip, unless other machines are accessing your db, setup your fw to block external traffic to MySQL port.

        As for the problems RHS had installing; dude, when did you do that install? I remember my first APACHE/PHP3 install had some funky stuff, but not like what you described. It's easy now, a vanilla install of Apache can work eith a PHP install by adding two lines in your apache conf and restarting.

        Cheers,
        Christian Anton


        -----BEGIN PGP SIGNATURE-----
        Version: PGP 8.0.2

        iQA/AwUBQLyCHyikRzf61a/AEQL7YQCfaa/2x7LI/ldJHwdFknmfEtVaZxIAoPD8
        Uola8XBPY/nhu9EEZceVFPrV
        =xlks
        -----END PGP SIGNATURE-----
      Your message has been successfully submitted and would be delivered to recipients shortly.