Friday, May 13, 2011

Some horrible horrible clues for php with pdo support on solaris

I have a drive going bad in one of my servers. Well, in the jbox attached to it. It's part of a mirror so as long as the other half holds until the new drive gets here, this is the swap plan.
Physically swap the drives.
Use the prtvtoc -> fmthard trick to push the vtoc from the other drive to the new drive
metareplace -e d50 c2t2d0s0

And then wait for it to sync. I can use the vtoc from the other half of the mirror since they are identical so I don't have to do that before the physical swap.

--------------
Now here's another horrible problem I worked through with Al Marti yesterday.

I needed php5.3.6 compiled with pdo and the extensions for it built. I grabbed the latest sfw package and installed it, but it didn't have options for enabling pdo in the php.ini. Sure enough, taking a look at the compile line used for the package, it didn't have pdo enabled. That means I have to compile php. I hate compiling php.

Compiling php is an amazingly annoying process for me. It never goes right, and the things that fail are things that should be problems in a big popular package. For the versions of 5.2 that I worked with before, I had to edit the makefile after running configure but before running make because of a typo in the makefile that wasn't in the configure line.

For 5.3.6 I had to cross link a library into /usr/lib even though the configure found the right directory with the file in it during the exploration phase of configure. Anyway...once I got configure working I ran into a problem with the system being unable to find libfontconfig.la. Sure enough, I couldn't find it either. Googling around produced nothing useful for me. Happily while Al was here, he caught a small misunderstanding. I had thought that on SunFreeWare if there was not a specific version number listed for a dependency for a package, then any reasonably recent version of that package would work. I was wrong, so I had missed some of the dependencies because the newer versions of the packages had different libraries. So that solved the libfontconfig.la problem.

Now on to the horrible...
So I get php compiled. It's got pdo enabled in the build. I can confirm that. Still no extensions for it. Al is looking around, I'm looking around. My brain fails so I decide to take a short break and build the apc module. Al sees that and asks about it, and suddenly we wonder "Could the pdo extensions be a pear/pecl module, not something built with the software?" So we try it.
pecl install pdo
Pdo exists! It starts to build! Yay! It fails! Boo!
pecl install pdo_mysql
Exists! Fails!
So we go back to googling around. After quite a while we both find the same bit of information pretty much at the same time. It seems ridiculous. Surely this isn't a reasonable solution just to get a module to build from a well known well used software package. But no...it is. We have to modify the code of the php package in order to get it to work.

From http://pecl.php.net/bugs/bug.php?id=18837
// /usr/include/php5/Zend/zend.h:320 add lines

#define refcount refcount__gc
#define is_ref is_ref__gc

// /usr/include/php5/Zend/zend_API.h:52 add lines

#define object_pp object_ptr


Completely ridiculous, but it works. The pdo package builds.

Now onto getting pdo_mysql to build. It fails because it can't find mysql_config. It finds the directory in which mysql_config exists, but fails to find the file. The file is right there. Baffling! More googling around turns up other people with the same problem but not a lot of solutions until we find this:
http://www.spiration.co.uk/post/1332/install%20PDO_MYSQL%20-%20mysql_config%20and%20header%20files%20problem

Which tells us to create a link from where it exists to another place, and the build will find it. Even though it's already finding the correct directory. Is that reasonable? NO! But we can't find anything else, so we try it. Sure enough...it works.

ln -s /usr/local/mysql/bin/mysql_config /usr/bin/mysql_config

Absolute madness. I hate building php. I really do. So far with us trying to use drupal I've been able to use a pre-built package successfully exactly once on 3 brand new machines when the installed version of php for Solaris was the newest, and we hadn't yet moved on to the newest version of drupal.

No comments: