| Summary: | PHP Script arguments not passed to script | ||||||
|---|---|---|---|---|---|---|---|
| Product: | z_Archived | Reporter: | Jérôme Vieilledent <jerome> | ||||
| Component: | PDT | Assignee: | Wojciech Galanciak <wojciech.galanciak> | ||||
| Status: | CLOSED FIXED | QA Contact: | |||||
| Severity: | major | ||||||
| Priority: | P2 | CC: | boboudreau+eclipse, bstone, devoir.nicolas, eclipse.org.accounts, ganoro, jerome, kane.mx, markajharrison, marksulls, matt.keeble, mindshifter, ptm, sadekbaroudi, silviya, wojciech.galanciak | ||||
| Version: | unspecified | ||||||
| Target Milestone: | --- | ||||||
| Hardware: | Macintosh | ||||||
| OS: | Mac OS X - Carbon (unsup.) | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
|
Description
Jérôme Vieilledent
I'm using PHP 5.2.14 compiled with MacPorts Mac OS X 10.6.4, PDT 64bits Hi Jerome I could not reproduce your problem when I use "debug as php script". both $argv and $_SERVER['argv'] show the arguments that I write in 'PHP Script Arguments' tab. works for me Hi Both $argv and $_SERVER['argv'] only contain path to my PHP script :-( Which version of XDebug do you use ? I'm using 2.0.5 installed with Macports. Thanks FYI, I upgraded to Xdebug 2.1.0 via PECL and it results the same :-( I have the same problem: Mac OSX 10.6.5 Eclipse for PHP Developers (64bit) Version: Helios Service Release 1 Build id: 20100917-0705 php-5.3.3 and xdebug v2.1.0 installed via homebrew (In reply to comment #7) Though I don't know Mac OS X at all... Command-line arguments are available only for CLI. Can you please ensure you are using CLI executable? How about 'SAPI Type' in your PHP Executable setting? It must be 'CLI', not 'CGI'. How about php version on command line such as >$ /usr/bin/php -v >PHP 5.2.4 (cli) (built: Sep 23 2007 22:34:35) >Copyright (c) 1997-2007 The PHP Group >Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies There must be '(cli)', not '(cgi)'. I double checked the SAPI type is set to CLI. Here is the php version:
> php -v
PHP 5.3.3 (cli) (built: Nov 9 2010 19:42:04)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
with Xdebug v2.1.0, Copyright (c) 2002-2010, by Derick Rethans
*** Bug 331312 has been marked as a duplicate of this bug. *** I tested it and it seems to be working... I have the same problem. Even when I enter ${string_prompt:Test} as a script argument, Eclipse is not displaying the prompt to ask for the proper value. My arguments are totaly ignored.
PHP 5.3.2 (cli) (built: Aug 10 2011 14:15:30)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
with the ionCube PHP Loader v4.0.7, Copyright (c) 2002-2011, by ionCube Ltd., and
with Xdebug v2.1.2, Copyright (c) 2002-2011, by Derick Rethans
My platform is Windows 7 with Eclipse SDK 3.6.2 and PDT 2.2.1.v20101001-23000-...
(In reply to comment #12) > I have the same problem. Even when I enter ${string_prompt:Test} as a script > argument, Eclipse is not displaying the prompt to ask for the proper value. My > arguments are totaly ignored. > > PHP 5.3.2 (cli) (built: Aug 10 2011 14:15:30) > Copyright (c) 1997-2010 The PHP Group > Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies > with the ionCube PHP Loader v4.0.7, Copyright (c) 2002-2011, by ionCube > Ltd., and > with Xdebug v2.1.2, Copyright (c) 2002-2011, by Derick Rethans > > My platform is Windows 7 with Eclipse SDK 3.6.2 and PDT > 2.2.1.v20101001-23000-... Sorry, this was my fault. After I enabled "Allocate Console" in the Debug Configuration script arguments are working like expected. (In reply to comment #5) > Hi > > Both $argv and $_SERVER['argv'] only contain path to my PHP script :-( > Which version of XDebug do you use ? I'm using 2.0.5 installed with Macports. > Thanks Try to check the configuration of the xdebug in the php.ini you use. Take me a while to see that I took a different configuration file... whith the one below that works ... xdebug.remote_enable = on xdebug.profiler_enable = on xdebug.profiler_enable_trigger = on xdebug.profiler_output_name = cachegrind.out.%t.%p xdebug.profiler_output_dir = "c:/tmp" xdebug.remote_handle=dbgp xdebug.remote_host=localhost xdebug.remote_port=9000 Good luck Hi I am having the same issue,.. php 5.3.6 xdebug 5.3.1 Eclipse Indigo Platform OSX 10.7.1 My php.ini... zend_extension="/Applications/XAMPP/xamppfiles/lib/php/php-5.3.1/extensions/no-debug-non-zts-20090626/xdebug.so" xdebug.profiler_output_dir = "/tmp/xdebug/" xdebug.profiler_enable = On xdebug.remote_enable=On xdebug.remote_host="localhost" xdebug.remote_port=10000 xdebug.remote_handler="dbgp" I have CLI Set Any suggestions? I Ran update for OSX Lion (10.7.2) and rebooted, guess what, args are being passed through now. Not sure why this is? Mark. Had to remove xampp and install dev environment nativly on osx lion, and this issue is happening again, i.e. not passing arguments when running a php script through debug configurations. php 5.3.6 Eclipse Indigo SR1 Would like a workaround if possible. I met this one as well.
localhost% php -v
PHP 5.3.13 with Suhosin-Patch (cli) (built: Jun 20 2012 17:05:20)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
with Xdebug v2.2.1, Copyright (c) 2002-2012, by Derick Rethans
PHP Development Tools (PDT) SDK Feature 3.0.0.v201201110400-77-184_2BEICRgM_fMVcz0M4Va9O
Mac 10.8.1
I also have this problem.
Eclipse:
Version: 3.7.2
Build id: M20120208-0800
php -v:
PHP 5.3.9-ZS5.6.0 (cli) (built: Dec 22 2011 12:28:41)
Copyright (c) 1997-2011 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies
with Xdebug v2.1.2, Copyright (c) 2002-2011, by Derick Rethans
with Zend Extension Manager v5.1, Copyright (c) 2003-2010, by Zend Technologies
- with Zend Data Cache v4.0, Copyright (c) 2004-2010, by Zend Technologies [loaded] [licensed] [disabled]
- with Zend Job Queue v4.0, Copyright (c) 2004-2010, by Zend Technologies [loaded] [not licensed] [disabled]
- with Zend Utils v1.0, Copyright (c) 2004-2010, by Zend Technologies [loaded] [licensed] [enabled]
- with Zend Code Tracing v1.0, Copyright (c) 2009-2010, by Zend Technologies [loaded] [not licensed] [disabled]
- with Zend Page Cache v4.0, Copyright (c) 2004-2010, by Zend Technologies [loaded] [licensed] [disabled]
I have followed the steps as described by the OP
1. Defined a new debug script configuration
2. Defined the php path
3. Defined a PHP script argument in dedicated tab
4. Check 'break on first line'
5. Inspect $_SERVER['argv'] on the first break - the name of my script is present but none of my script arguments are appended.
The fact that this is still a bug 2 years after first being reported is a bit of an issue don't you think?
Sorry - should have mentioned, platform is Mac OS X 10.7.5 (In reply to comment #19) > I also have this problem. > > Eclipse: > Version: 3.7.2 > Build id: M20120208-0800 > > php -v: > PHP 5.3.9-ZS5.6.0 (cli) (built: Dec 22 2011 12:28:41) > Copyright (c) 1997-2011 The PHP Group > Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies > with Xdebug v2.1.2, Copyright (c) 2002-2011, by Derick Rethans > with Zend Extension Manager v5.1, Copyright (c) 2003-2010, by Zend > Technologies > - with Zend Data Cache v4.0, Copyright (c) 2004-2010, by Zend > Technologies [loaded] [licensed] [disabled] > - with Zend Job Queue v4.0, Copyright (c) 2004-2010, by Zend > Technologies [loaded] [not licensed] [disabled] > - with Zend Utils v1.0, Copyright (c) 2004-2010, by Zend Technologies > [loaded] [licensed] [enabled] > - with Zend Code Tracing v1.0, Copyright (c) 2009-2010, by Zend > Technologies [loaded] [not licensed] [disabled] > - with Zend Page Cache v4.0, Copyright (c) 2004-2010, by Zend > Technologies [loaded] [licensed] [disabled] > > I have followed the steps as described by the OP > > 1. Defined a new debug script configuration > 2. Defined the php path > 3. Defined a PHP script argument in dedicated tab > 4. Check 'break on first line' > 5. Inspect $_SERVER['argv'] on the first break - the name of my script is > present but none of my script arguments are appended. > > The fact that this is still a bug 2 years after first being reported is a > bit of an issue don't you think? Same issue but with both "Debug Configurations" and "Run Configurations" on my plateform: * Windows 7 Pro 64-bits * Eclipse SDK 3.7.2.M20120208-0800 (64-bits) * PHP Development Tools (PDT) SDK Feature 3.1.1.201209101312 * PDT Extensions Feature 1.0.12 * PHP 5.3.19 (32-bits) ----------8<---------- > php -v PHP 5.3.19 (cli) (built: Nov 21 2012 21:48:06) opyright (c) 1997-2012 The PHP Group end Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies with Xdebug v2.2.1, Copyright (c) 2002-2012, by Derick Rethans ----------8<---------- Disabling Xdebug doesn't change anything. Reproducible: Always PHP Code to reproduce (file "/myproject/run.php"): ----------8<---------- <?php var_dump($_SERVER['argv']); ----------8<---------- Steps to Reproduce: 1. Define a new Debug or Run configuration of type "PHP CLI Application" "PHP Script" tab: Runtime PHP: Project default PHP: in my case: "PHP (Xdebug 5.3.19 CLI)" PHP file: "/myproject/run.php" "PHP Script Arguments" tab: Script Arguments: --option1=value "Common" tab: Standard Input and Output: Allocate console (necesarry for input): ticked ([X]) 2. Apply & Run/Debug configuration Outputs (in Eclipse Console): ----------8<---------- array(1) { [0]=> string(26) "/path/to/myproject/run.php" } ----------8<---------- Expected outputs, what is actually outputed when script is runned from system shell (`php /path/to/myproject/run.php --option1=value`): ----------8<---------- array(1) { [0]=> string(26) "/path/to/myproject/run.php" [1]=> string(15) "--option1=value" } ----------8<---------- Tryed Claus's advice (comment #12) to place a "${string_prompt:Test}" in Script Arguments field: no prompt. Using a file as "Standard Input and Output" (instead of a console) doesn't resolves anything (same script output). Wow, thanks Claude. PDT uses the code such as "sapiType == PHPexeItem.SAPI_CLI" in many places(e.g. org.eclipse.php.internal.debug.core.launching.PHPExecutableLaunchDelegate.launch()). This should be "PHPexeItem.SAPI_CLI.equals(sapiType)" since it is String type. PHPexeItem.SAPI_CGI as well. PHP 5.3.23 (cli) OSX 10.8 Eclipse (4.2 - Juno) PDT I had the same problem as all of the posters, but was able to fix the problem. Even though you may have a CLI build of PHP, you need to register the $argc and $argv variables to get them to show up in Eclipse. Check your php.ini file for "register_argc_argv". Mine was set to Off. Setting it to On fixed the problem. Created attachment 237326 [details] Image reproducing Bug 323931 Merged by Jacek. It was fixed by a patch for Bug 402829. I do not see any complains for a long time. I tested on Luna with current PDT 3.5 / PHP 5.5.12/ xDebug. Passing arguments worked OK. Therefore I'll close this bug. If anyone still have a similar problem please reopen with more information/steps to reproduce (or open a new issue if you prefer). |