This is an odd one. My shell of preference is ZSH and oddly I like to write scripts that do server maintenance in PHP. Odd, yes, blasphemous no.. I was writing a script that would do some database queries, format the results all pretty then fire off an email. The formatted queries were saved in variables then echoed into the email. Straightforward enough. Except I couldn’t get it to work. I had written the script on our intranet server and it worked fine, now it wouldn’t work on one production server. No matter what I tried I couldn’t get it to work.

Then I went back to square one. I wrote a one line PHP file: EVEN THAT WOULDN”T WORK!! Dear lord and I losing it!? Finally I asked someone else to look at the issue. He logged into his account and the script worked flawlessly. WTF!? I was seriously beginning to run out of hair to pull out. Then I noticed the differences between our setups. He was running bash and I was running zsh. I swapped over to bash and sure enough everything started working again. So why then did the script work on my intranet server and not production? I checked the zsh versions, production zsh 4.2.6; intranet zsh 4.3.4. There you have it.

I started messing around with the issue and found that it was only the PHP echo command that was giving problems. It seems that when the PHP (cli) interpreter hit the echo command it just crashed the program. I changed all my echos to prints and everything seems to be working just fine now. So yeah, just for future reference, ZSH 4.2.6 seems to really not like some PHP cli commands. Not that it should even care… :-p

Comments are closed.