Enable MySQL and PostgreSQL support for PHP5

by wszdw142 on 2008-04-07 20:23:50

It was quite a hassle installing PHP5 for the first time using the compilation method.

Last weekend, our company's SVN server suddenly "broke," which was really frustrating. After checking, it turned out that SVN had automatically upgraded (does it even have this feature? Only my boss and I know the server password, and neither of us touched it... sob). Some of its files were no longer supported due to the low version of Apache (2.0.3x) installed. Dizzy!

We decided to upgrade Apache. The latest version at that time was 2.0.52. Previously, we had installed the RH 3.0AS version via RPM packages. As a beginner, I didn't know how to upgrade using the compilation method, so I opted for a full installation. I stopped the previous service and started the new version's service. Unfortunately, PHP was no longer supported: ( . This was actually a good opportunity to try the new version of PHP (5.0.3). After performing the default installation (./configure, make, make install) and configuring Zend, my inventory management program written in PHP stopped working. Surprisingly, the default installation did not support MySQL or other databases, and the php.ini file was no longer located in the /etc directory. Why are you doing this...

After reading the manual and researching materials, I finally managed to fix everything after several days of effort. Pretty dumb, huh? But hey, as they say, "If it's hard, you don't know how; if you know how, it's not hard."

In fact, it was quite simple—just add the parameters --with-mysql=/usr/bin --with-pgsql=/usr/bin during the ./configure step. If you need support for other databases or additional features, just include those parameters as well.