Debugging (Xdebug) of post queries


I want to ask about my debuggig workflow.

I have javascript register form which sends post request to /user/register URI.

My application uses index.php as single entrance point due to .htaccess with RewriteRule directive:

RewriteRule ^(.*)$ /index.php/$1 [L]

To debug this request I use following debuger configurations:

Configuration -> File: path_to_app_dir/index.php
Command Line -> Environment variables: REQUEST_METHOD=POST;REQUEST_URI=/users/register

But besides that, I have to insert this code at the beginnig of index.php file:

$_POST['login'] = 'lofin';
$_POST['password'] = 'password';

This approach works well for me, but I'm curious: do I do everything right? Maybe there is better, easiest and more proper way to do this?

1 comment
Comment actions Permalink

Hi there,

Have a look at this article:

This approach does not require creation of Run/Debug Configurations at all (Run | Edit Configurations...) -- you can debug your actual live website as is.

If you need to debug some specific request with specific parameters only -- use "PHP HTTP Request" type of Run/Debug Configuration -- should be easier to what you are doing ATM (rigth now you executing "PHP Script" type of Run/Debug Configuration, which is for running scripts in CLI mode on your loacl computer).


Please sign in to leave a comment.