The Path to Apache Happiness

I'm moving Workbench and dozens of other sites to ServerMatrix, a host in Dallas with some ridiculously low prices for fast servers with generous bandwidth.

Though I am becoming a Linux zealot, I remain awestruck by the amount of grief required to get the components of a LAMP platform -- Linux, Apache, MySQL, Perl, PHP, and Python -- working together successfully.

I burned an entire afternoon Saturday because of a weird issue with PHP that worked fine in Apache 1.3 but was hosed in Apache 2.0.

In my PHP scripts, I grab arguments from the $REQUEST_URI environment variable (PATH_INFO in CGI) rather than using a query string, replacing a search engine unfriendly URL with something better.

Collecting variables from the path is easy in PHP:

list($i1,$i2,$id_number) = explode('/', $REQUEST_URI, 3);

This wasn't working on the new server: Apache thought these URLs referred to real directories, responding with a file not found error for every script that used path info.

Thanks to Dan Anderson's terrific Apache 2/PHP installation page, I found the solution: turn the new AcceptPathInfo directive on in httpd.conf:

AcceptPathInfo On

Simple enough, once you find it, but I made a crazed Kenny Stabler scramble around Google for many hours until I did.

Comments

Style points for the Kenny Stabler reference ++

Add a Comment

All comments are moderated before publication. These HTML tags are permitted: <p>, <b>, <i>, <a>, and <blockquote>. This site is protected by reCAPTCHA (for which the Google Privacy Policy and Terms of Service apply).