This is my first post here, I post because after reading through X articles googling can't get PhpStorm, Xdebug work with CLI scripts.
Already tried to follow advices from:
PHPStorm + XDebug Setup Walkthrough
https://confluence.jetbrains.com/display/PhpStorm/Zero-configuration+Web+Application+Debugging+with+Xdebug+and+PhpStorm
PHPStorm + XDebug + Vagrant
and few blogs that I've found online, but still nothing...
I had it working, but after destroy vagrant recently and now can't fully restore this feature.
SETUP:
I'm running Symfony project on Vagrant.
Debugging of "webpages" on my server works just perfectly.
When I try debug CLI Command I prequisite it with:
export XDEBUG_CONFIG="XDEBUG_SESSION=1"
export PHP_IDE_CONFIG="serverName=vagrant"
XDEBUG.INI (on Vagrant):
zend_extension=xdebug.so
xdebug.remote_enable=1
xdebug.remote_host=192.168.0.133 (ip I get from ifconfig -a on Vagrant)
xdebug.remote_port=9000
xdebug.max_nesting_level=2500
xdebug.remote_handler=dbgp
xdebug.remote_autostart=1
xdebug.remote_connect_back=1
xdebug.idekey="PHPSTORM"
Any help much appreciated. Digged through X articles on web but in my eyes all configurations look ok, no idea what to do...
Set xdebug.remote_connect_back to be 0.
This option prevents you from using right IP address when you are doing Remote CLI debugging. Since it's a CLI debug, the IP will always be local (vagrant machine) while you need another one.
This option works OK when debugging over browser as request comes from your "real" computer. But when doing CLI debug .. request will be local to Vagrant machine.
When this option is set to 1 (as it is done now) it ignores the setting from #2 below.
xdebug.remote_host=192.168.0.133 (ip I get from ifconfig -a on Vagrant) -- this should be an IP of your computer where PhpStorm is running as seen from Vagrant machine.
Combination of those 2 above will do the job for you.
Related
I use PhpStorm 2021.3 on MacOS (Apple Sillicon M1). I'm not sure the problem is with PhpStorm but PHP Code Sniffer doesn't work.
When I type this command it doesn't show any errors in the code and I'm sure I got some.
vendor/bin/phpcs
The only thing that appears in the console is Time: 38ms; Memory: 8MB
CodeSniffer is installed by composer.
On the other hand, if I enter this same command in Docker (with Laravel Sail, in bash), I do get a list of errors/warnings in my code.
Going back to PhpStorm, I tried to configure the IDE to work with PHPCS in Docker, but it still doesn't work, and I don't know where to look.
PHP_CodeSniffer version 3.6.2 (stable) by Squiz
How to make CodeSniffer work, either through PhpStorm or automate it in PhpStorm and Docker?
I have come across this issue multiple times when helping a new hire and each time i have to go through different steps each time to rediscover the fix. These are things that have made it work, unfortunately i am slightly less technical than I used to be and dont exactly know why they work, but they do. Hence i have decided to put this out here, hoping my next new hire will come across this when searching for a fix.
⠋ Connecting to localhost on port 9515...
Starting ChromeDriver 87.0.4280.88 (89e2380a3e36c3464b1382549290d-refs/branch-heads/4280#{#1761}) on port 9515
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
⚠ Error connecting to localhost on port 9515.
Here is a list of things to try:
Upgrade to the lastest version of Chromedriver by deleting node_modules, update the version of chromedriver in package.json and npm install.
An upgrade has fixed such an error message 3 out of 5 times that i have seen it happen.
Check if a chrome driver process is already running on the system and has placed a lock on the port that you are trying to access. Sometimes, chromedriver does not quit when it stops in error, as a result the port from your config is not available and the subsequent runs fail.
On a mac follow these steps :
ps -ax | grep -i chromedriver
Find the PID of the process ( usually an integer in the first column ), then :
kill < PID >
In nightwatch.config.js ( or figure out which config file is being used from your package .json script key ) add :
selenium: {
start_process: true }
If there is already a selenium object, add a comma after the last k-v pair and append this k-v pair to it.
I'm trying to setup CLI Xdebug in the Lando environment.
It works flawlessly from the web, but I can't manage to make it working from CLI to debug tests and scripts.
Here is my .lando.yml file:
name: develop
recipe: wordpress
proxy:
appserver_nginx:
- develop.loc
config:
php: '7.3'
via: nginx
database: mariadb
xdebug: true
I use PHPStorm as my IDE. I already setup server, server mapping, and ports 9000 and 9003 for listening, but it still doesn't stop at breakpoints.
Did anyone setup CLI Xdebug with Lando? Any ideas? Thanks for helping.
I managed to make it working.
So, the idea is to setup two environment variables:
PHP_IDE_CONFIG="serverName=localhost", where localhost is the name of the server in your PhpStorm settings.
XDEBUG_TRIGGER="1" - this variable triggers the xdebug.
But how can we provide the variables dynamically to make XDEBUG_TRIGGER working only when you want to?
For such things Lando has the tooling option!
So, we can create the custom command which would make the magic happen, like this:
tooling:
phpdebug:
service: appserver
cmd:
- php
env:
XDEBUG_TRIGGER: 1
PHP_IDE_CONFIG: "serverName=localhost"
Then restart (or rebuild) you appserver, and you'll have a brand new custom command for debugging PHP from CLI, like this:
lando phpdebug test.php
So, it works the same as lando php test.php, but with providing all the environment variables needed to run Xdebug.
Update:
If someone is interested in how to debug WP CLI from the Lando environment:
lando phpdebug /app/vendor/wp-cli/wp-cli/bin/../php/boot-fs.php --version
So, it's the same as lando wp --version, but with providing Xdebug environment variables
P.S. Please be aware - it's the instructions for Xdebug 3.
I have read the posts similar to this but to no avail.
I am in the midst of a comprehensive tutorial for Angular (5). I am on MacOs High Sierra 10.13.3. I am using Chrome Version 64.0.3282.140 (Official Build) (64-bit).
I just completed one project in the tutorial. I am now trying to complete the next project in the tutorial. The project is set to use the default port 4200 on localhost. All of the projects have executed this way.
I have performed my npm install. My npm start script is simple, = "ng serve". I enter npm start and it serves up the project as expected. I then go to my browser and enter the address localhost:4200. The previous project renders. I can't get the current project to render. These are the things I have tried to remedy the situation:
sudo lsof -i tcp:4200
changing the start script to ng serve --port 4300 and then using the address localhost:4300 (tried it with 5000 too)
Actually the first thing I did was look for an active activity on port 4200 in the Activity Monitor
Clear my Chrome browsing history
Restart my computer.
Tried the same process using Firefox as a browser
Tried it using Brave as a browser
In each and every case when I enter localhost:(anything) I get the previous project. Any ideas?
If I could delete this question I would. I discovered the problem.
I only THOUGHT I was pointing to the new project. In reality, I was pointing at the old project. THAT is why the same thing kept coming up and that is why nothing I tried would work.
I am embarrassed. Clearly, I am still a rookie. I hope no one spent any time on this.
I have a scalable Python 2.7 app on OpenShift and I'm getting this 503 error.
I checked some answers that might work but they say to rhc into the app and change the Haproxy configurations, but I don't have a clue on how to do it.
Can someone help me please?
1) Install rhc: https://developers.openshift.com/en/managing-client-tools.html and read https://blog.openshift.com/how-haproxy-scales-openshift-apps/
2) Run $ rhc setup for the initial configuration of the tool and check https://developers.openshift.com/en/managing-log-files.html#accessing-logs-via-ssh for viewing haproxy logs
3) Run rhc ssh --app yourapp, once inside, cd haproxy/conf and change your haproxy.cfg appropriately
I edited haproxy.cfg:
option httpchk OPTIONS * HTTP/1.1\r\nHost:\ {{ my app link }}
It’s working now.