Friday, November 27, 2020

Dreamhost upgrade to Apache 2.4 causes "[an error occurred while processing this directive]"

 I host https://www.fincher.org with a great hosting service, Dreamhost.  They recently upgraded my server from Apache 2.2 to 2.4.  It broke my whole site.

I wrote a Content Management System (CMS) 20 years ago using Server Side includes and Perl (yes, Perl).  It has worked flawlessly for decades and then got tripped up on this upgrade.

What happened? Testing for empty variables happened.  For example, if I want a page to have Google ads, I would define a variable at the top of a file

<!--#set var="AdsTop" value="AdsTop" -->

and then later include a file that tests for that variable,

<!--#if expr="${AdsTop}" -->

... include file with Google Ads ...

<!--#endif -->


Apache, changed the way variables are tested to be more explicit, which I can appreciate their thinking.
Now in 2.4 if you want to test if the variable "AdsTop" is not empty use the "-n" option:

<!--#if expr="-n v('AdsTop')" -->
... include file with Google Ads ...
<!--#endif -->

(or use "-z" to test for empty).


You can skip the upgrade and set SSILegacyExprParser to on, but in my experience, falling behind on upgrades, eventually bites you in the behind.





No comments: