Re: [TTLUG] php mysql.sock problems
- Vidyaratha Kissoon wrote:
> Hi all,I am by no means a PHP expert, but I seem to remember that when
> 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 ?
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?
- -----BEGIN PGP SIGNED MESSAGE-----
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.
-----BEGIN PGP SIGNATURE-----
Version: PGP 8.0.2
-----END PGP SIGNATURE-----