0

I am using PhpStorm 2018.2.1 on Windows 10.

I have Homestead Vagrant box setup for Laravel. My Laravel application is working as expected. Recently I have configured Xdebug for my PHP 7.1 and configured PhpStorm according to this article but when I am starting to debug I am getting the following error:

vagrant://C:/Users/Suman/Homestead/usr/bin/php -dxdebug.remote_enable=1 -dxdebug.remote_mode=req -dxdebug.remote_port=9000 -dxdebug.remote_host=10.0.2.2 /home/vagrant/Code/news/app/Http/Controllers/HomeController.php
PHP Fatal error:  Class 'App\Http\Controllers\Controller' not found in /home/vagrant/Code/news/app/Http/Controllers/HomeController.php on line 8
PHP Stack trace:
PHP   1. {main}() /home/vagrant/Code/news/app/Http/Controllers/HomeController.php:0

Fatal error: Class 'App\Http\Controllers\Controller' not found in /home/vagrant/Code/news/app/Http/Controllers/HomeController.php on line 8

Call Stack:
    0.1118     383032   1. {main}() /home/vagrant/Code/news/app/Http/Controllers/HomeController.php:0


Process finished with exit code 255

I don't know how to proceed from here. What could be the problem?

enter image description here

1
  • "What could be the problem?" You are doing it wrong. Right now you are 1) Trying to execute your script in a CLI environment (and not a web page) and 2) you are calling your HomeController class directly bypassing the whole framework code and therefore missing composer's class autoloader (that's why Controller class is not found). You need to do Web Page debug and not PHP Script (which is CLI environment). Start here: confluence.jetbrains.com/display/PhpStorm/… Commented Aug 19, 2018 at 22:20

1 Answer 1

0

Looks like you have a configuration issue. It appears you are attempting to run your vagrant php scripts through your windows php interpreter?

vagrant://C:/Users/Suman/Homestead/usr/bin/php -dxdebug.remote_enable=1 - 
dxdebug.remote_mode=req -dxdebug.remote_port=9000 -dxdebug.remote_host=10.0.2.2 
/home/vagrant/Code/news/app/Http/Controllers/HomeController.php

Note that it is calling the interpreter here: c:/users/Suman/Homestead/usr/bin/php but it is looking for a your controllers on the vagrant box '/home/vagrant/Code/news/app/Http/Controllers/HomeController.php

Although the files will be on your windows drive and you will mount them to your vagrant instance upon boot, all the work should be happening on the vagrant box itself. Phpstorm will edit the files through the windows machine, but the running and debugging will occur in the vagrant instance (in the mounted folder).

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.