access error on running Xdebugger

When I try to debug project then homepage opens in the browser and break point is also hit

whereas, when i try to debug a file using netbeans and xdebugger then Access denied page opens in the browser and waiting for connection shows in the bottom of Netbeans.

Here is the address what i get in my browser:

localhost/mywebproject/protected/views/site/index.php?XDEBUG_SESSION_START=netbeans-xdebug

And this is the error that shows up in the window

[b]Access forbidden!

[/b]

You don’t have permission to access the requested object. It is either read-protected or not readable by the server.

If you think this is a server error, please contact the webmaster.

Error 403

I am clueless what do i do. Yoour help would be highly appreciated. Thanks.

i see your link is point to : localhost/mywebproject/protected/views/site/index.php

so this is normal, Yii place an .htaccess file in protected folder to prevent the access to application directory from public.

all you need to do is to tell Netbeans to start from the bootstrap index.php which is located in your WEB ROOT directory.

for default Yii installation, in Netbeans go to project properties --> Run Configuration

Project URL : http://localhost/mywebproject/

Index File : index.php

i hope this will fix your issue ::)

Thanks for the reply Muaid.

But i checked the project properties settings and its the same that you have mentioned. In fact, when i say debug project then in that case I am not facing error, It works perfect. Its only when i ask to debug the file then this error of access denied comes up.

Exactly !! :)

i don’t know why you may debug a (view) file alone! or any file in Yii rather than index.php bootstrap ! but to solve this for testing and development environment you can just remove/rename .htaccess file if you want to debug any particular file inside protected folder.

UPDATE: typo.

It doesn’t make sense to debug individual files as the entry point is the main index.php, always.

The view files is php by convention, but they could be called .ctp or .view or whatever. It’s run by Yii::WebApplication through the main index.php.

It seems my approach is wrong. I will just explain what i am trying to do. Please guide me the right way to achieve it.

I want to debug a function which is in say restaurantInfo model, I have put a break point on a function which is responsible for search. How can I route the Xdebugger to hit that break point?

Thanks in advance :)

ok, put a break point on functions you like ex: in your restaurantInfo mode.

then you have tow approach here:

1- start the debugger and it will open : localhost/mywebproject/index.php?XDEBUG_SESSION_START=netbeans-xdebug

then just route (navigate) to the concern controller that will fire up your code which have a break point.

2- in Netbeans go to project properties --> Run Configuration

add Arguments. Ex: r=restaurantInfo/update&id=38

in this case it will start the debugger directly to request (update Action) in (restaurantInfo Controller).

this is the concept, i hope you got my point :rolleyes:

thanks…it works when i add the argument in run configuration under project properties. Although. i was not able to use the navigation method.

And i think, now i understand the point of both of you and Jacmoe, that there is no point debugging just the model. As we will have to understand the complete flow of program and values of variables that are being transferred which we will not be able to do if we debug the model directly? am i right?

So is there any place where we need to define the address, maybe at bootstrap file or some other? I am little confused but I hope you understand my point. :)