Recent Posts

Drupal and MySQL "Row size too large" Error

I encountered a MySQL bug that intersected in an unfortunate way with how Drupal (D6) functions. The result was a big red box with this message:

User warning: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. You have to change some columns to TEXT or BLOBs query: content_write_record ...


Key to removing all bookmarks from PDF with PDFtk command-line

Periodically, there is a need to remove all bookmarks from a PDF. Sometimes the bookmarks become unwieldy. Sometimes planned document mergers render the bookmarks superfluous. Other times, you just don't want them. Regardless of the motivation, pdftk seems like an appropriate tool for quick adjustments of this sort. Unfortunately, as its features have evolved, this is a use case of apparently secondary concern.


Bootstrap Drupal from other scripts

Drupal 7 has an issue discussing some strategies for inclusion. However, I wanted to accomplish a similar task in Drupal 6. One flaw with triggering the standard Drupal bootstrap is that it attempts to handle the request. A strategy that was more successful for me, at least within the context of command-line scripts, was to bootstrap Drupal via Drush to avoid the Drupal FrontController pattern. The code was pretty simple.



QuipXml is chainable PHP objects for manipulating XML. Unlike other libraries that attempt to replicate jQuery syntax throughout, Quip attempts to provide lightweight extensions to SimpleXML to facilitate cleaner code without imposing JavaScript conventions on a PHP project. The end result is fast and easy to use.


VPN Error 0x80072afc: The requested name is valid, but no data of the requested type was found.

I encountered this error while working on a SSL (SSTP) VPN setup. The distinctive characteristic was that we defined the VPN host in the computer's hosts file, although the same error could be encountered by an improperly configured DNS entry.

Supporting extremely large file uploads with PHP

Any time you think about "unlimited," you likely think about the cloud, and that is about the only way to do this. With PHP, any standard file upload must remain under the post_max_size and the upload_max_filesize. There are client-side solutions that can chunk a file to make it uploadable without increasing your limits, but even those require you to pay close attention to your disk space and to your temp directory space. Chunking the upload and storing the chunks on cloud-backed storage can address most concerns. However, the combination of Amazon S3, Amazon IAM and Plupload provide a compelling stack that allows for unlimited uploads to a secure cloud-based storage provider without any impact on your web server. Below are some of the keys steps that facilitate leveraging these exciting technologies.


The Standard PHP Library (SPL) provides various utility classes and interfaces to address common problems. Some of the most visible solutions center around the SPL Iterators. The ability to iterate over a non-array collection and then to iterate over that iterator creates an interesting design pattern for building with PHP. However, the iterators deprioritize conciseness and therefore (to some degree) readability.


Get Server's Local IP with PHP

There is an easy way to get the local IP of a server using PHP.


APC Console

Our web site platform is highly efficient, primarily due to the aggressive caching we have implemented using APC. APC has performance advantages over other systems like Redis and Memcache because it avoids any kind of protocol overhead. It is tightly integrated and allows PHP to access the key-value pairs in memory. However, it comes with the drawback that any command-line PHP does not have access to the same cache because it is running in a different process. This becomes a major issue when there are intensive background processes that are run, and it can become a major source of database load in configuration-heavy systems like Drupal. So how do we leverage the online cache that has been built when working with console applications?


Working with XML in PHP

PHP has several built-in strategies for handling XML, but each comes with its own limitations (e.g., DOM is verbose, SimpleXML has limited creation capabilities). The weakness of built-in solutions has led to a proliferation of XML libraries. Stack Overflow has a post that identifies 13+ substantial projects. The syntax of many of the projects has been influenced by jQuery, and several of the projects (e.g., phpQuery and QueryPath) explicitly attempt to replicate jQuery functionality.