Other Things Can Bite

Chad Pytel

I was having a lot of problems with getting ps2pdf working from a CGI Perl program running under Apache on Windows at a client’s site. If you’ve been paying attention you might ask “Why are you running Apache on Windows and Perl?”. That’d be a good question. The answer is because this stuff was written before we made that switch, and also necessity and compromise… definitely a topic for a future post.

Anyway, ps2pdf would work from the commandline, but from the Perl script the batch file that ps2pdf calls (ps2pdfxx) was not being found. Despite my Google kung-fu, it took me a while to find what looked like the solution.

Excited, I did what it said, but it still didn’t work! After trying everything else I could think of, I tried the old trick for Windows – rebooting… Turns out, environment variables don’t take effect for Apache on Windows unless you restart the computer, even restarting the Apache service doesn’t work.

I figure I better post it here for posterity, although hopefully you’re not actively deploying code running under Apache on Windows.