When I try to debug PHP using CGI Emulation, I get this error:
No input file specified.
This is because your PHP CGI interpreter has been compiled with cgi.force_redirect set to on for security reasons. We can fix this in Komodo by changing this setting in the copy of php.ini that Komodo uses:
- open the php.ini copy that Komodo is using:
~/.komodo/host-<hostname>/php/<php-version>/php.ini
- change the setting:
; cgi.force_redirect = 1
to
cgi.force_redirect = 0
Save the php.ini, then try debugging using CGI Emulation again.
komodo 4.01 on ubuntu 6.10
I've set cgi.force_redirect to 0 on every php.ini on my system, yet I still get "no input file specified" every time I try to run the following script using cgi emulation:
$hr = "<HR>";
echo "$hr\n";
if (array_key_exists('foo', $_POST)) {
print("_POST[foo]=:" . $_POST['foo'] . ":<BR>$hr\n");
} else if (array_key_exists('foo', $_GET)) {
print("_GET[foo]=:" . $_GET['foo'] . ":<BR>$hr\n");
} else {
print("no foo defined<BR>$hr\n");
}
//phpinfo();
echo $hr;
?>
This is because the Ubuntu PHP is set to discard the script file path and not set SCRIPT_FILENAME in the environment. I have yet to find a magic bullet for this issue when using Ubuntu's php build.
--
JeffG | Komodo IDE 4.0 | MacBook Pro OS X Intel / Ubuntu 6.10 i386
I am having a similar experience under Archlinux (not Ubuntu) using Komodo 4.1.1, build 279677, platform linux-libcpp5-x86.
Regardless of the cgi.force_redirect setting, I get the 'No input file specified' message upon debugging with CGI Emulation. I see that the Debugger Configuration wizard sets cgi.force_redirect to 0 in its "copied" php.ini (along w/ the xdebug reference).
The only way I found around this issue was to manually set the SCRIPT_FILENAME as a CGI environment variable. Set this to the absolute path of the .php file to be debugged.
Screenshot:
- http://farm2.static.flickr.com/1419/882417034_53018a8b16_o.png
Does anyone have other ideas for a fix?
Thanks,
~ Brice
Open up Komodo file:
<install_dir>/lib/mozilla/components/koInvokeInterpreters.pyAt line 600, add another environment flag "SCRIPT_FILENAME" so it looks like:
env["SCRIPT_FILENAME"]=pathTranslated
env["REQUEST_METHOD"]=requestMethod
Restart komodo and your CGI scripts should debug properly.
Cheers,
Todd
Todd,
Your fix worked perfectly. Thanks for the prompt response.
I assume this has made it's way into the beta -- which I look forward to participating in once I purchase the IDE. Komodo is, after all, a project worth supporting! ;)
~ Brice
What else could be causing this? I've tried everything above with no luck.
Komodo 4.3 beta
PHP 5.2.5
Windows XP
The trial period ran out before I had a chance to test cgi debugging, so I installed the beta to extend my trial and finish testing things out...
Can you try using Komodo 4.3.2 or the Komodo 4.4 beta:
http://downloads.activestate.com/Komodo/releases/
If that does not fix the problem, we'll need some additional details like:
* where did you download PHP from
* how are performing the CGI debugging (through Komodo's Debug - F5 command)
* which interpreter is set in your PHP language preferences
Thanks,
Todd
Thanks for the help Todd.
I'm using:
Komodo IDE, version 4.4.0-beta1, build 19400, platform win32-x86.
Built on Fri May 30 02:25:59 2008.
Web Developer Suite 2.0 which includes Apache 2.2 and PHP 5.2.5
http://sourceforge.net/projects/webdeveloper/
Preferences, PHP Language:
Interpreter: c:\www\php5\php.exe
php.ini: c:\www\php5\debug
I also tested with c:\www\php5\php-cgi.exe and received the same results.
the debug\php.ini was created during installation of Komodo. It's the default php.ini with the following prepended from Komodo:
; xdebug config added by Komodo
zend_extension_ts=C:\www\php5\ext\php_xdebug.dll
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_port=9000
cgi.force_redirect = 0
I verified that those parameters are commented out everywhere else in the php.ini file.
Choosing Debug -> Go/Continue:
I choose "Use the CGI interpreter"
I check "Simulate CGI Environment"
and I add the post values according to the debugging PHP tutorial / demo.
It works if I choose "Use the CLI interpreter", but then it doesn't allow me to specify the post variables.
The only thing I can think to add at this point (in case it helps) is a copy of the php.ini along with lists of extensions enabled in php.
It looks like doc_root setting in the php.ini bundled with Web Developer Suite 2.0 causes problems for the remote debugger. Comment out that line in c:\www\php5\debug\php.ini and it should work.
Thanks for bringing this to our attention! We'll create a bug for Komodo to handle this better and mention it in the release notes, but it's unlikely to be fixed in time for the 4.4 release.