Run configuration, script parameters

runconf.png
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.

5 comments
Comment actions Permalink

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).

0
Comment actions Permalink

Hello OZ,

You can set necessary values manually.

In such manner, for example.

if(isset($argv['debug'])){
    $_GET['key'] = 'value';
    $_POST['key'] = 'value';
}


Thank you for feedback!

0
Comment actions Permalink

Heh, I can write even easily: $_GET['key']='value'; :) But it's not usable for testing completed scripts.

0
Comment actions Permalink

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:
/test2.php?key=zz

As for POST parameters ... I guess this is the right ticket to watch: http://youtrack.jetbrains.net/issue/WI-5175?projectKey=WI

0
Comment actions Permalink

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 :)

0

Please sign in to leave a comment.