How can I get Xdebug working in PHPStorm with Laravel? - laravel

I'm following the Laracast for PHPStorm and setting up xdebug. When I run xdebug on a controller in my laravel project, it prompts me to install a chrome extension. If I install said chrome extension, I just get a browser window stating Fatal Error: Class 'BaseController' not found . Jeff doesn't mention this extension, nor does anyone in the comments. As a result, I'm not seeing anything in the debugger except "Connected to JetBrains Chrome Extension". What gives? I followed the tutorial precisely.

I follow this jetbrains guide plus proxying tunneling the 9000 port.
For me Proxying / Tunneling the Debugger Connection do the trick.
I need to bring port 9000 to my local machine like this:
ssh -R 9000:localhost:9000 vagrant#192.168.50.10 //or wathever ip of you homestead
instead of run homestead sh for login to my homestead machine.
I hope works for you.

Related

Error while installing WSL for windows 11

when i run the command on administrator settings on my windows 11
wsl --install
it shows me the following error
a connection with the server could not be established
I searched youtube too for the fixes but none worked
Hi I was having same error. I am Indian using Jio Fiber. I connected to VPN to solve the error. It seems that Jio prevents connection to certain url such as https://raw.githubusercontent.com/microsoft/WSL/master/distributions/DistributionInfo.json which are needed for wsl linux installation. You can check by trying to open above link in chrome and running network diagnostics. Basically the above url gets called at the end when you do wsl --install.
I tried to install it with VPN and it works. Using VPN may work for you.

Laravel Brower Test (Dusk) error on MacOS (Docker): Failed to connect on localhost port 9515: connection refused

I just installed Laravel's Dusk to add browser tests. However, when I run a test, I get a Failed to connect on localhost port 9515: connection refused error.
I checked online and it seems like a lot of people are having the same issue. I came across few solutions e.g. this but it seems like they are all for Windows and Homestead whilst I am running my project on MacOS and Docker.
I did try to follow the solution but I found out sudo apt is not available for MacOS. I then installed Homebrew and tried to run the commands starting with brew instead of sudo apt but it responds saying no formula available for the name.
I would really appreciate it if you could recommend a solution or source I could look at. Thank you.
In case if someone else is having the same issue:
Basically, the issue was I was just following the Laravel Dusk Documentation without making any further configuration.
For the Docker environment, more configuration has to be done such as adding a Selenium container to allow the browser tests to run.
Checkout Jake Harris's 7 steps to running Laravel Dusk 3.0 tests in Docker environments to do this.
Thank you.

PhpStorm Xdebug connected but not stopped

Hello yesterday I've had faced strange issue with xdebug in PhpStorm.
As you can see I pass the PhpStorm validation:
But when I enable listener and start debug session, it just hangs.
Also in xdebug logs I can see right file name and line on which it must stop. But PhpStorm doesn't show me that break.
If there is no breakpoint site loads correctly. If I enable PhpStorm's option "Break at first line in PHP scripts" it correctly stops in index.php but I can't step over/in. (just hangs)
It would be great if someone can help me.
P.S. My Xdebug was working for years, yesterday i reinstall Apache and this issue happened, already tried to completely reinstall PHP and Apache, issue still persist.
After some more research i found this
topic.
I check my phpstorm log and found exact same error:
ERROR - plication.impl.ApplicationImpl - Argument for #NotNull parameter 'remoteFileUrl' of com/jetbrains/php/debug/xdebug/debugger/XdebugDriver.onBreak must not be null ...
Solution was to intall older version of xdebug. I just install 2.6.1 (2.7.0 was installed) and all works now.

Laravel Dusk on Centos: Failed connect to localhost:9515; Connection refused

OK, today is the day. I finally started (again) to use TDD.
I notice that this thing called Dusk has appeared. Great, browser testing.
The only problem is that I get this:
Failed connect to localhost:9515; Connection refused
I did chmod 777 on the chromedriver files and still get the error.
My dev server is a Centos vm. Is this the problem?
Edit:
I think I am making some progress:
yum install GConf2
Now I get:
cannot find Chrome binary
EDIT
I am back on this now.
php artisan dusk gives me:
Facebook\WebDriver\Exception\UnknownServerException: unknown error: cannot find Chrome binary
(Driver info: chromedriver=2.28.455506 (18f6627e265f442aeec9b6661a49fe819aeeea1f),platform=Linux 3.10.0-327.3.1.el7.x86_64 x86_64)
If I do this:
./vendor/laravel/dusk/bin/chromedriver-linux
I get this:
Starting ChromeDriver 2.28.455506 (18f6627e265f442aeec9b6661a49fe819aeeea1f) on port 9515
Only local connections are allowed.
Any ideas?
Mick
Try running: ./vendor/laravel/dusk/bin/chrome-linux
If you see:
Starting ChromeDriver 2.28.455506 (18f6627e265f442aeec9b6661a49fe819aeeea1f) on port 9515 (or whatever port you are using)
Only local connections are allowed. Then it is working. I also had to install the google-chrome binary:
How to install 64-bit Google Chrome on 64-bit RHEL/CentOS 7
The other thing to install is Xvfb. Then you can run this command in a new terminal: Xvfb :0 -screen 0 1280x960x24 &
This is supposed to be the way to run this. I however, have not been able to get this to work. I am hoping someone can also add some input here.
Update:
I got his to work. Make sure that nothing is running as root.

Ip not ping for vagrant homestead

I am getting problem when i open my project app url in browser then its getting timeout. if i open ip address also then also timeout.
I have already installed vagrat , virtual box on my mac machine.
I am following these steps
First clone my project in tony/project
Cd project
composer install
vagrant init laravel/homestead
php vendor/bin/homestead make
vagrant up
when i run vagrant ssh then it goes to ubantu
I have also include my homestead.yaml file ip or app name in /etc/hosts.
Now when i open app name like project.app or ip like 92.168.10.10 then its not run.
When i open my virtual machine and there is also a box running like project_default_44443334_2323.
Please le me know what is issue . where i am wrong. please help
Reboot your computer and try again in a browser:
192.168.10.10
192.168.10.10:8000
If it still doesn't work, try to temporarily turn off firewall and antivirus software, including Windows built in firewall and try again.

Resources