Fork me on GitHub

article

Case Insensitivity and a bite in the ass

March 16, 2007 | PHP Scripting

I made a disturbing discovery lately and I can’t believe that it has taken me this long to run across it. Case insensitivity in OS X can play havoc with a website, like completely bring it down, if any capitalization errors are made and not caught before moving to a case-sensitive server, like a unix server. And its all, most likely, attributable to HFS+.

I first noticed issues with including files in PHP. If I include a file that is named File.php and I request file.php there will be no error on OS X and the file will include. On unix this will fail. 4 years and I’ve never run into this before… I don’t know why. This one at least makes sense as it is the file system’s behavior and should be expected.

The next is a bit disturbing. Case insensitivity slips into MySQL. And not just through PHP. Through CocoaMySQL as well and even through the MySQL command line client. I’ve successfully called a table like AP_users by asking for AP_Users and gotten the right table, and successfully queried it as well. Again, moving the system to unix works as expected – table not found.

I’m not only baffled by this behavior but also by how I could have overlooked it for so long. My solution is gonna be to move all sites and sql databases to a UFS partition to force case sensitivity, unless, someone has a better idea (no, I’m not switching all out to *nix). So far this is the only solution I’ve been able to come to.

4 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

  • Annoying, isn’t it?

    I recall that there is an HFS+ Case-Sensitive option in Disk Utility, but the catch is that some Mac applications tend to have problems when installed on case-sensitive volumes.

    Take care with the capitalizations in the future. 😉

    James Badger, March 21, 2007 11:13 am | permalink

  • Yeah, I noticed that after I wrote this. I have partitions now because of Boot Camp, but since I’m more than likely gonna ditch Boot Camp in favor of Parallels I think I’ll make one partition a web only partition with either UFS or HFS case insensitive and put the webserver docs and mysql directories there (if I can in fact move the data directory).

    Shawn Parker, March 21, 2007 4:08 pm | permalink

  • I just got bitten in the ass because of this. Argh.

    joel, May 16, 2007 11:20 pm | permalink

  • You should read my blog more, then!

    Shawn Parker, May 20, 2007 1:01 am | permalink

Comments are closed