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....

LVL 11
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

you surely searched enough?


a quick overview looks like you may forget a host, a user/pass or that you havent created a propriate user within mysql with enough grants.

maybe theres also a firewall blocking an essential mysql port?

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
IsisagateAuthor Commented:
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

IsisagateAuthor Commented:
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.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.