There seems to be an issue in PHP 5.2.6 with extensions where the extensions have to be loaded in a certain order or the PHP interpreter has a tendency to crash and fail miserably. It is weird, as depending on the system configuration the order of the extensions has to be entirely different.
Certain extensions have a dependency on other extensions and their functionality so it is understandable that they are required to be loaded before the other modules can be loaded, however this has never been an issue before. I am not entirely sure how PHP does it, but I am betting it loads all the modules and then runs an init function of sort, and since all the modules are loaded at the same time, there are no issues.
However, in this case it seems that multiple functions are clashing, or something along those lines.
Running PHP in a gdb session showed the following:
Program received signal SIGSEGV, Segmentation fault. 0x00000000 in ?? () (gdb) bt #0 0x00000000 in ?? () #1 0x29803544 in __do_global_dtors_aux () from /usr/local/lib/php/20060613/simplexml.so #2 0x29807c04 in _fini () from /usr/local/lib/php/20060613/simplexml.so #3 0x2824f558 in tls_dtv_generation () from /libexec/ld-elf.so.1 #4 0x28251558 in ?? () from /libexec/ld-elf.so.1 #5 0xbfbfe9c8 in ?? () #6 0x282327b6 in elf_hash () from /libexec/ld-elf.so.1 #7 0x282350a0 in dlclose () from /libexec/ld-elf.so.1 #8 0x081374e4 in zend_hash_apply_deleter () #9 0x0813757f in zend_hash_graceful_reverse_destroy () #10 0x0812da7c in zend_shutdown () #11 0x080f4f67 in php_module_shutdown () #12 0x081aa892 in main ()
So it seems that simplexml is the culprit here, lets remove it. Once removed from extensions.ini we re-run gdb and give it the same information we gave it before, this time however we see this:
Cannot load module 'SPL' because required module 'simplexml' is not loaded in Unknown on line 0
My gut instinct is to now move simplexml ABOVE the line that says extension=spl.so. After we do this, PHP is able to run without any issues. Now, for the fun:
extension=spl.so extension=xml.so extension=ctype.so extension=zlib.so extension=session.so extension=mbstring.so extension=pdo.so extension=pdo_sqlite.so extension=ftp.so extension=posix.so extension=pcre.so extension=json.so extension=zip.so extension=suhosin.so extension=pdo_mysql.so extension=bz2.so extension=openssl.so extension=gd.so extension=pdf.so extension=hash.so extension=mhash.so extension=curl.so extension=mcrypt.so extension=xmlwriter.so extension=tokenizer.so extension=filter.so extension=simplexml.so extension=iconv.so extension=sqlite.so extension=dom.so extension=xmlreader.so extension=gettext.so extension=tidy.so extension=mysqli.so extension=mysql.so extension=sockets.so extension=pspell.so extension=imap.so extension=ncurses.so extension=xsl.so
Is the extension list on one of the servers I administrate. Notice that spl.so is at the top of the file, and simplexml.so is somewhere in the middle. And this works perfectly, however the same file on a second server causes it to bomb spectacularly. However, I had kept a backup of the original extensions.ini on the second server, put it back, and then experimented with it, and this is what came out:
extension=simplexml.so extension=spl.so extension=suhosin.so extension=json.so extension=zip.so extension=filter.so extension=hash.so extension=session.so extension=sysvmsg.so extension=gd.so extension=pdf.so extension=tidy.so extension=magickwand.so extension=odbc.so extension=calendar.so extension=sysvshm.so extension=soap.so extension=tokenizer.so extension=mcrypt.so extension=iconv.so extension=readline.so extension=sysvsem.so extension=bz2.so extension=zlib.so extension=ftp.so extension=pcntl.so extension=ncurses.so extension=posix.so extension=gettext.so extension=mhash.so extension=pcre.so extension=mbstring.so extension=xmlwriter.so extension=xml.so extension=xmlrpc.so extension=sqlite.so extension=openssl.so extension=ctype.so extension=ming.so extension=dom.so extension=xmlreader.so extension=curl.so extension=mysqli.so extension=mysql.so extension=sockets.so extension=imap.so extension=xsl.so
Now when I tried this on the first system where that first configuration file comes from, it bombs spectacularly leaving a core-dump. I have NO IDEA what is going on. I just know that log messages like the following:
pid 54662 (php-cgi), uid 80: exited on signal 11 (core dumped) pid 54655 (php-cgi), uid 80: exited on signal 11 (core dumped) pid 54658 (php-cgi), uid 80: exited on signal 11 (core dumped) pid 54661 (php-cgi), uid 80: exited on signal 11 (core dumped) pid 54660 (php-cgi), uid 80: exited on signal 11 (core dumped)
are a thing of the past, until next time when I upgrade or re-compile PHP and the order is played with again.
If you have any hints, insights or knowledge of what is going on, and what magic order I have to place the extensions in, please let me know by sending me an email at xistence@gmail. This is going to be a mystery, for now, as I definitely don't have the time to figure out what is going on and why.