Personal.X-Istence.com

Bert JW Regeer (畢傑龍)

Updating Drupal and Cleaning Out Old Posts

I spent some time updating Drupal to the latest version that is currently available. The last install had been running on the same old version for a long time, and it was about time. Surprisingly the following update method worked very well:

Download Drupal 5.16, use the update.php script to update the blog to the 5.16 version. No errors were presented in any way shape or form which really surprised me, hats off to the Drupal developers for building a system that is stable and works correctly. After which I had some trouble, off course the old theme was now missing so logging into my Drupal was going to be an issue without an actual theme to display any of the menu's. After using some SQL-fu I regained access. Changed the theme back to the default, and things were good to go.

Next up, I grabbed Drupal 6.10. Ran its update script and everything once again went smoothly. Way smoother than any other upgrade for any of the other PHP scripts that I have had the pleasure of upgrading, then again it has been a long time since I last upgraded something as complex as Drupal. phpBB was an absolute mess to upgrade at one point in its life, have not touched it for a while so it may have improved.

Besides the newer version, there are also some modules I have now enabled. You will see that the URL's to the posts no longer contain the node/[number] format and instead are /[yyyy]/[mm]/[dd]/[post title], this should make Google and other search engines more happy than they were before, and it will make linking to a post on my website much easier. All of the old URL's still exist but will be a 301 redirect so that Google and the likes will update their search index's with the new links.

Stale content on this website, or content that was not relevant anymore has also been removed. Mostly related to things that were happening in my personal life at the time (some of the content is still up), also removing content that if it were read now, it would do more harm than good. Other content that I have removed were posts that were time/date limited and do not apply anymore to the current situation as it stands and had no real historical value.

With all of these changes in mind, I would like to apologise for those of you with feed readers that don't correctly check the date on when posts were created, you will have had all of these changes show up as yet another item in the news feed. The feed reader I personally use had no such issues since the date on the various articles had not changed, just the URL.

PHP 5.2.6 on FreeBSD with extensions

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.