Tech: Centos 5 builds PHP without MySQL connectivity

November 10, 2009 on 12:44 pm | In Tech | No Comments

Been trying to migrate a webapp onto a machine running CentOS 5 Linux.

Couldn’t QUITE get it to work right, and I thought it was some shitty coding. Nearly despaired for reading through poorly documented PHP codes.

Till I figured I might try to install WordPress on the same machine and see if there’s some OTHER possibility…

And I immediately got a very useful error message.

PHP isn’t connecting to MySQL.

Indeed phpinfo() revealed that the PHP was configured –without-mysql

WTF?! This is really n00b. CentOS will install Apache, PHP and MySQL all together, but forget to enable this vital connectivity.

So I downloaded PHP 5.3

And while configuring, I’m getting a problem with libxml2.

Checked with yum, and I already have the libxml2 installed, and it’s the latest version.

Then tried

wget ftp://xmlsoft.org/libxml2/LATEST_LIBXML2

and if it wasn’t a newer version than yum already installed… This one compiled and installed properly. (ie ./configure, make, make install).

Now tried configuring PHP 5.3 again, this time usingĀ  –with-mysql

Got an error. That mysql isn’t bundled in 5.3 anymore.

Found on MySQL instead, that PHP 5.3 now comes with native drivers.

Thus, ./configure –with-mysql=mysqlnd –with-mysqli=mysqlnd –with-pdo-mysql=mysqlnd

Now… what happens when there’s 2 versions of PHP on my machine >.>

And then, it seems that I need to configure PHP with the –with-apxs option as well.

But that doesn’t work cos the Apache installed with CentOS doesn’t have this enabled either.

So, have to yum install httpd-devel

Then reconfigure PHP with ./configure –with-mysql=mysqlnd –with-mysqli=mysqlnd –with-pdo-mysql=mysqlnd –with-apxs

That worked. Finally.

Note: Stop the Apache service before make install.

Then, Apache won’t start up, cos of some Undefined Symbol thingie.

Aaahh…. this is the Linux I know. And for a moment, I thought those days have passed me by.

So, managed to sort out that problem above… Did a:

ldd -d libphp5.so

So it’s apparent that there’s a lot of Undefined Symbols. Oddly enough this was easy enough to fix:

make clean

THEN, do the configure, make, make install again.

And this time, it works. I’ve got PHP5.3 working. Finally.

But during the make test, I saw some errors connecting with MySQL. So, it’s still not connecting to MySQL.

The quest continues…..

Entries and comments feeds. Valid XHTML and CSS. ^Top^
23 queries. 0.665 seconds.
Powered by WordPress with jd-nebula theme design by John Doe.