Yii2 PHPStorm Debug Environment Issue

Hi Guys,

Error I am getting is :
PHP Fatal error: Uncaught Error: Class ‘yii\web\Controller’ not found in /Applications/MAMP/htdocs/yii-application/backend/controllers/SiteController.php:13
Stack trace:
#0 {main}
thrown in /Applications/MAMP/htdocs/yii-application/backend/controllers/SiteController.php on line 13

I am new to Yii, but I am trying to configure development environment for it. I have installed PHPStorm, and everything is working on web browser if I open through URLs in a browser.

I want to debug code through step by step debugging and for that I have installed Plugins, Yii2 Support, Yii2 Inspections, and Php Inspections.

I have tried giving Yii Root Path to

  • /Applications/MAMP/htdocs/yii-application/vendor/yiisoft
  • /Applications/MAMP/htdocs/yii-application/vendor/yiisoft/yii2

I must be missing some essential step, can you guys help ?

Hi,

Did you install and configure xdebug for your PHP?
What does your Run/Debug configuration look like?

Here’s an interesting resource: https://medium.com/@uginpo/how-to-debug-a-yii2-project-with-xdebug-and-phpstorm-ide-112e6cf50768

Hi Mehdi,
Thanks for taking time out to respond.

I think XDebug is properly configured, as I am able to debug simple php files other than Yii2 Projects.

Attached herewith is image of validation of configuration.

Ok.

(Just to clear out the confusion: The Yii Root Path, Yii2 Support, Yii2 Inspections & PHP Inspections have nothing to do with xdebug & the problem you’re facing.)

The Debugger configuration seems ok. Now how did you configure your Debug configuration?

Here’s mine for my frontend:
49%20AM

And the configuration for the “Front” server being used

I might be doing this incorrect, can you also show me your server configuration ?

My error is mentioned above, that means, when it tries to load it is unable to identify this path

Server is classic Apache with mod_php

Can you screenshot your configuration?

So when I try to Debug Controller, it comes to this line. At this line it is unable to find yii\web\Controller.