FileMaker Addict Has Moved!

FileMaker Addict can now be found here: http://www.filemakeraddict.com




Wednesday, July 09, 2008

Getting FileMaker / PHP / MySQL to "Play Nice"

I have a client for whom I recently installed FileMaker 9 Server Advanced on a brand new dedicated Windows 2003-based server. It is running fine -- I was even able to easily work around the usual installation problem where the FMS installer cannot see IIS. All was good...

This morning, I attempted to install an open source PHP/MySQL-based bulletin board application called Simple Machines Forum ("SMF") on that server. I had installed MySQL, and already had PHP 5.2.4 installed (as part of the FileMaker Server installation). I loaded up the application in the browser, and received this:

Call to undefined function mysql_connect

Yikes! Ok, so something isn't installed or configured properly. I created a quick PHP template that dumps the PHP configuration info using a call to the "phpinfo()" function. There was no mention of MySQL in the config info, which is a sign that the MySQL extension is loaded.

I then opened the PHP initialization ("php.ini") file (which, on this server, is located at C:\Program Files\FileMaker\FileMaker Server\Web Publishing\publishing-engine\php\) and found that the call to the MySQL extension was commented out (";extension=php_mysql.dll"). So I uncommented it (by removing the ";" at the beginning of the line), and refreshed the page. The same error was displayed: Call to undefined function mysql_connect. Ugggh!

Next, I looked for other configuration issues, and everything looked okay. However, clearly the MySQL extension wasn't loading. So I confirmed that the php_mysql.dll file really was up there on the server, and it was (in C:\Program Files\FileMaker\FileMaker Server\Web Publishing\publishing-engine\php\ext ). So... now what?

Finally, I realized that I had not restarted IIS after making the change to the configuration file. To do this, I stopped and restarted the World Wide Web Publishing Service using the Services administrative utility. I reloaded the page and.... drumroll please... It worked!

To sum things up, if you are planning on using the PHP version that gets installed with FileMaker Server and want PHP to be able to interact with MySQL, do the following:

1. Find and open the "php.ini" file.
2. Uncomment the ";extension=php_mysql.dll" line.
3. Restart the World Wide Web Publishing Service.

-- Tim