Sunday, March 27, 2011

Fast CGI Crash in debugger in PhpED

I use NuSphere's PhpED for my PHP debugging, and I'm constantly having problems with the fact that it has its own PHP installation that conflicts with my PHP installation for IIS. The problem is that both installations, by default, look in C:\Windows for the Php.ini file.

I recently installed PhpED on my new Windows 7 system and started having trouble again with crashes whenever I ran the debugger. The error was:

CGI / FastCGI has encountered a problem and needs to close.

Really, really annoying. Up until now I've worked around this problem with a batch file that sets PHPRC, but there is a simpler way if you are using PHP CLI instead of the built-in Apache server:
  1. Go to Tools / Settings
  2. Under Run & Debug, click on PHP CLI
  3. Under "Additional environment variables", set PHPRC to:

    C:\Program Files (x86)\NuSphere\PhpED\php5
If you are using Apache, there's a separate value you can set in httpd.conf, but it will be overwritten with each upgrade of PhpED.