Link to home
Start Free TrialLog in
Avatar of Isisagate
Isisagate

asked on

URGENT: mysql_connect fails

I am trying to setup a local linux box as a development enviornment for my project. This is my first real crack at setting up a linux server. At this point I have all the major pieces on and working (apache, php, mysql, etc) but I am having trouble getting php to connect to mysql. I can get to mysql just fine from the command line or through gui toolsso it's up and running but when my php scripts try and connect I get the following error

Warning: mysql_connect(): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (13) in /var/sites/sitename/html/includes/database.php on line 558

I've been looking all over the web for solutions and tried almost everything but haven't had any luck. So here is what I have tried let me know what I need to do...

I tried changing the location of the mysql.sock file from /var/lib/mysql/mysql.sock to /tmp/mysql.sock through the /etc/my.cnf file then I went into the php.ini file and altered the default socket to point to /tmp/mysql.sock... and restart mysql and apache but the error continued....

I've checked permissions and those are fine.

I've tried passing the socket location '/tmp/mysql.sock' in through the mysql_connect function and still get the same error except the '/var/lib/mysql/mysql.sock' not says /tmp/mysql.sock

The version of of software are as follows...
OS = Fedora Core 4
php = 4.3.11-2.8
mysql = 4.1.16-1
apache = 2.0.54-10


any ideas? this is the last step to me being able to use this box....

ASKER CERTIFIED SOLUTION
Avatar of AmigoJack
AmigoJack

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Isisagate
Isisagate

ASKER

the users are infact created with all priviledges, the port is not blocked, the apache web server and mysql reside on the same box "localhost" is the host being used.
can you give us an excerpt of ALL your code until the error raises?
after the mysql_connect function call add some error checking, eg.


mysql_connect('localhost', 'user', 'pass') or die(mysql_error());





That will output the last error given, let us know what if anything that outputs




Alright here is what I know so far.... I disabled SELinux (security enhanced Linux) that's new to fedora and the connection doesn't bomb any more however no data is being written to the page. The page's none database content is being written to the page but where the data is supposed to be there is nothing. Suggestions on how to fix or diagnose what's up configuration wise? The code that is being executed works fine on my windows dev machine and my linux web hosting server but not here so something still seems flakey with the configurations.