You are here

META: Duct tape and bailing wire

So I had a really nice blog entry typed in for today. Now it's gone, and you get this one instead...

I've edited all my blog entries some. That's what I had written about. In particular, a recording of The Finite Automata Song is now attached to the January 3 entry. Ah, there's the rub.
For the life of me, I could not upload the #@$! MP3 attachment. The upload ground along for two full minutes, then silently stopped without result. Spent probably an hour figuring out that it was a file size thing, another hour figuring out that it was mostly PHP4's fault rather than Apache's, Drupal's, etc. A final hour of hacking sufficed to figure out how to work around the problem. Now you can upload big attachments to this Drupal.
In the process, my typed-in but not-yet-submitted blog entry got accidentally destroyed when I closed a browser window.

For the record, if you want to be able to upload large attachments to your Drupal running on Apache 2 and PHP 4 on a Debian Linux box, here's what you need to do:

  • There's administrative settings that control Drupal upload sizes in the administration/settings/upload area. These seem to act somewhat strangely---just set them all to something big.
  • You'll need to edit /etc/php4/apache/php.ini to increase at least the max upload size and max post size. Don't set the sizes to 10240M though; that apparently overflows PHP4's puny integers and breaks most of Drupal. 1024M seems to work. I increased a bunch of the timing settings also, but this may not be necessary.
  • Now restart Apache. Apparently, the PHP4 module can't be bother to check its INI file for currency regularly. (Why does my UNIX box have a global INI file with these settings anyway?)
  • Close your browser to kill any running session and log into Drupal again. You should now be set.

Why was this so hard to figure out? Duct tape and bailing wire. Apache is a giant mess, and its configuration is awful. PHP4, whose only reason for existence as near as I can tell is to build web pages, uses a completely different configuration system. It also has the temerity to think that things like file upload limits can be sensibly set on a global basis. Drupal doesn't override the PHP4 settings it needs to. It also provides no indication of a PHP failure. I don't know whose fault that is; maybe PHP gives sensible failure indications Drupal is ignoring, or maybe not. All of these components log in random ways in random places, and are hit-and-miss in whether and what they report about their status.
The net result is a system that is very difficult for me to set up, maintain, diagnose, and repair. I've been doing system, internet, and web stuff for a long time. I have an MS in programming languages, and a Ph.D. in artificial intelligence. I make good money as a consultant in industry in software engineering. I'm old and immodest, and I think I can legitimately say that if I have a hard time with this stuff, it's broken.
I'll try to generate something more interesting tomorrow. Tonight I'm going to bed; tomorrow I'll be ready for my 0730 meeting. Sure I will.



This advice also applies to PHP5, where it just saved my butt. Duct tape and bailing wire indeed. Thanks, Bart!