On 1 June 2010 16:30, What you get is Not what you see <wygin...@gmail.com> wrote: > Freshly installed on openbsd 4.6 mysql,php and php5-mysql packages. > Done the configs. Now php and mysql works. But I couldnt make it > connect to mysql from within php with such a command > mysql_connect("localhost","user","pass") > It used to give "Cant connect to mysql through socket error" till I > change the command to > mysql_connect(127.0.0.1,"user","pass") > I want to learn why? >
As you've been already told, this is because default apache is chrooted and thus cannot access mysql socket. To correct it, just do # mkdir -p /var/www/var/run/mysql # ln -f /var/run/mysql/mysql.sock /var/www/var/run/mysql/mysql.sock -- The best the little guy can do is what the little guy does right