Run configuration, script parameters Follow Evgeniy Created February 24, 2011 18:14 Tell me, please, how to set parameters.I want to set $_GET['key']='zz' (or ?key=zz)This forum posting page still bugged, so read from bottom to top.Hello.
When using Php Script configuration, parameters are accessed like from the command line, via $argv, see http://php.net/manual/en/reserved.variables.argv.php.
If you want to test parameters passed via $_GET, you need to run your script on server (using PHP Web Application Run/Debug configuration where you can specify URL to open with parameters).
You can set necessary values manually.
In such manner, for example.
Thank you for feedback!
Heh, I can write even easily: $_GET['key']='value'; :) But it's not usable for testing completed scripts.
As Serge already mentioned, PHP Script run configuration is for running scripts in CLI mode where you cannot pass GET/POST parameters automatically (unless you set them in your code directly).
You can easily pass GET parameters when using PHP Web Application run configuration -- just add them to the script URL (Start URL field). In your example it will be something like:
As for POST parameters ... I guess this is the right ticket to watch: http://youtrack.jetbrains.net/issue/WI-5175?projectKey=WI
I have not enough experience with running php in CL, and now I understand that this idea can not be normaly done, because of CLI restrictions.
Thanks for tips, excuse me for this stupid theme :)
I know it's almost ten years since last comment in this thread but its still in google first page so I want to share other people the solution I found witch fixed this problem .
So passing arguments to php cli using phpstorm configuration won't fix the problem cause you can't pass a variable value and tell php cli to assign it to variable . At least you can't do it directly . But by using some hacks you can do it really easily.
Using debugging mode is not necessary, but it's a best practice at least for situations that I don't want to delete some "debugging specific codes" that I wrote before deployment.