PHP is Strange Voodoo
All I want is a simple database management program.
All I need is to create tables, rows, and fields, insert or edit data, things that aren’t always convenient on the mysql command line. (editing of data in particular.) The only decent program I’ve found is phpMyAdmin, which of course requires a web server and php. I’ve tried every native DB management tool in portage, and several not in portage, to avoid these requirements. They all bite ass. Even MySQL‘s own management tool is buggy and missing features. Is this really so difficult a request?!
Anyway – phpmyadmin decided to die yesterday, after I hadn’t used it for a month or so. The strange voodoo that commenced haunts me to this day.
First of all, I have php running through fastcgi sockets with lighttpd. The main problem I had last night was that php-cgi would always segfault (the dreaded signal 11) whenever lighttpd tried to spawn it. I fiddled with some settings and somehow managed to totally hose my computer. Lighttpd, which is certainly a nice product, has absolutely ghastly error reporting. It’s unhelpful to the extreme. (Not as bad as some others, but come on – we’re enlightened now, and lighttpd is a modern program.) It proceeded to log approximately 9872473 errors per second, filling up my hard drive in mere seconds. If you’ve ever experienced that without /var/log being on a separate partition, let me spoil it for you – it’s not all that fun. You can’t run anything to find out what’s taking up the space.
I fiddled a bit more. Now, php-cgi wasn’t segfaulting, but lighttpd couldn’t communicate with the sockets. Believe it or not, I was getting a “connect failed, connection refused” on my own socket. What, praytell, does my socket have to refuse? It’s refusing the process that created it. Genius.
Anyhow. I’m not sure if this is a Gentoo-related problem or not, but I’m hoping it’ll help someone out in the future. I tried running php-cgi in a console, and while it didn’t segfault, it was giving errors about a missing java.so file. Java? Integrating Java and PHP is the programmatic equivalent of putting two underfed pit bulls in a sleeping bag.
It turns out that something told PHP to load a nonexistent java module. All you have to do is delete the java-related files from /etc/php/cgi-php/ext* and ext-active. That will make php-cgi happy, which will make the fastcgi socket happy, which will make lighttpd happy, which will make your php apps happy. I need a nap.