Remote Coder Blog

A brief respite from my coding closet

Uncovering problems with PHP and MYSQL

April26

As school winds down and projects ratchet up a notch (or two) i’ve been trying to get PHP to talk with MYSQL dynamically.

One of the problems I’ve been encountering has been the mysql_connect() command inside my php pages.

Typically I’ve seen errors like so:

Fatal error: Call to undefined function mysql_connect() in “blah blah blah on line “blah blah blah”

Reading all of the google results based on this formula I had to go into my PHP.INI file and insure that the extensions relating to mysql have their “;” (semicolons) removed.

But that didn’t fix my problems. I was still having connectivity issues.

Reading up on another site, they talked about their mysql.dll’s perhaps not loading correctly.

Within your php installation folder there resides a driver called libmysql.dll

This file is the driver that my Apache web server was lacking. The recommendations for where to put libmysql.dll ranged from Windows, to System32. I also found out that it was probably a good idea to drop it into the Apache/bin folder as well.

Then reboot.

This process has taken me over 4 hours to track down as my process basically started by combing through my php syntax to make certain that every “;” was where it needed to be, and every single tick ( ‘ ) had a matching tick, and then I was able to focus on tracking down some MYSQL scripts that would simply test for connectivity.

I even blew out all installations of MYSQL in order to reinstall a fresh DB. Lucky for me I’ve created SQL scripts to recreate the DB’s and populate the data.  This by no means should tell you that I am out of the woods with solving ALL of my problems. I did get to resolve the primary issue which was DB connectivity, and now I have to clean up some non-DB syntax issues. (variables, functions, etc).

But that was a major hurdle and one I wanted to document here. Hope it helps you out too.

posted under MYSQL, PHP, Programming

Comments are closed.