PhpStorm + Docker + Xdebug + DB SSH tunnel
up vote
1
down vote
favorite
Locally I have following docker-compose configuration:
nginx:
build:
context: ./nginx
ports:
- "80:80"
volumes:
- ./../logs:/home/web/logs/
- ./../:/home/web/my-website.com/
depends_on:
- php
php:
build:
context: ./php
volumes:
- ./../:/home/web/my-website.com/
working_dir: /home/web/my-website.com/
expose:
- "8123"
php
container has Xdebug installed into it, I can easily connect to it from PhpStorm.
I have remote ClickHouse database which is connected via SSH Tunnel. When I start my container I just go into my container and execute:
ssh -4 login@host.com -p 2211 -L 8123:localhost:8123 -oStrictHostKeyChecking=no -Nf
After this, my site is able to use this connection, but when I execute console command
./yii analysis/start-charts 003b56fe-db47-11e8-bcc0-52540010e5bc 205
from PhpStorm, I'm getting an exception:
Failed to connect to 127.0.0.1 port 8123: Connection refused
If I jump into the container and launch the same command, everything works fine.
What's wrong? Why PhpStorm doesn't see my SSH tunnel?
php docker phpstorm xdebug ssh-tunnel
add a comment |
up vote
1
down vote
favorite
Locally I have following docker-compose configuration:
nginx:
build:
context: ./nginx
ports:
- "80:80"
volumes:
- ./../logs:/home/web/logs/
- ./../:/home/web/my-website.com/
depends_on:
- php
php:
build:
context: ./php
volumes:
- ./../:/home/web/my-website.com/
working_dir: /home/web/my-website.com/
expose:
- "8123"
php
container has Xdebug installed into it, I can easily connect to it from PhpStorm.
I have remote ClickHouse database which is connected via SSH Tunnel. When I start my container I just go into my container and execute:
ssh -4 login@host.com -p 2211 -L 8123:localhost:8123 -oStrictHostKeyChecking=no -Nf
After this, my site is able to use this connection, but when I execute console command
./yii analysis/start-charts 003b56fe-db47-11e8-bcc0-52540010e5bc 205
from PhpStorm, I'm getting an exception:
Failed to connect to 127.0.0.1 port 8123: Connection refused
If I jump into the container and launch the same command, everything works fine.
What's wrong? Why PhpStorm doesn't see my SSH tunnel?
php docker phpstorm xdebug ssh-tunnel
Running it in PhpStorm equals running it using your machine's terminal: the command isn't run inside of a container. I would assume that running./yii analysis/start-charts 003b56fe-db47-11e8-bcc0-52540010e5bc 205
in a console of your workstation would also fail? Btw, are you running this command simply in Terminal or you're doing Tools > Start SSH Session... > etc?
– Ástþór
Nov 12 at 10:36
@Ástþór, as far as I know, PhpStorm uses an interpreter, which I set in project settings. In my case, it uses interpreter from docker container, on my workstation no PHP installed. According to your second question, firstly I execute commanddocker exec -u www-data -it docker_php_1 /bin/bash
and only then I execute command./yii analysis/start-charts ...
– Nikita Leshchev
Nov 14 at 9:22
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
Locally I have following docker-compose configuration:
nginx:
build:
context: ./nginx
ports:
- "80:80"
volumes:
- ./../logs:/home/web/logs/
- ./../:/home/web/my-website.com/
depends_on:
- php
php:
build:
context: ./php
volumes:
- ./../:/home/web/my-website.com/
working_dir: /home/web/my-website.com/
expose:
- "8123"
php
container has Xdebug installed into it, I can easily connect to it from PhpStorm.
I have remote ClickHouse database which is connected via SSH Tunnel. When I start my container I just go into my container and execute:
ssh -4 login@host.com -p 2211 -L 8123:localhost:8123 -oStrictHostKeyChecking=no -Nf
After this, my site is able to use this connection, but when I execute console command
./yii analysis/start-charts 003b56fe-db47-11e8-bcc0-52540010e5bc 205
from PhpStorm, I'm getting an exception:
Failed to connect to 127.0.0.1 port 8123: Connection refused
If I jump into the container and launch the same command, everything works fine.
What's wrong? Why PhpStorm doesn't see my SSH tunnel?
php docker phpstorm xdebug ssh-tunnel
Locally I have following docker-compose configuration:
nginx:
build:
context: ./nginx
ports:
- "80:80"
volumes:
- ./../logs:/home/web/logs/
- ./../:/home/web/my-website.com/
depends_on:
- php
php:
build:
context: ./php
volumes:
- ./../:/home/web/my-website.com/
working_dir: /home/web/my-website.com/
expose:
- "8123"
php
container has Xdebug installed into it, I can easily connect to it from PhpStorm.
I have remote ClickHouse database which is connected via SSH Tunnel. When I start my container I just go into my container and execute:
ssh -4 login@host.com -p 2211 -L 8123:localhost:8123 -oStrictHostKeyChecking=no -Nf
After this, my site is able to use this connection, but when I execute console command
./yii analysis/start-charts 003b56fe-db47-11e8-bcc0-52540010e5bc 205
from PhpStorm, I'm getting an exception:
Failed to connect to 127.0.0.1 port 8123: Connection refused
If I jump into the container and launch the same command, everything works fine.
What's wrong? Why PhpStorm doesn't see my SSH tunnel?
php docker phpstorm xdebug ssh-tunnel
php docker phpstorm xdebug ssh-tunnel
edited Nov 11 at 13:43
LazyOne
106k20240257
106k20240257
asked Nov 11 at 13:12
Nikita Leshchev
1,057620
1,057620
Running it in PhpStorm equals running it using your machine's terminal: the command isn't run inside of a container. I would assume that running./yii analysis/start-charts 003b56fe-db47-11e8-bcc0-52540010e5bc 205
in a console of your workstation would also fail? Btw, are you running this command simply in Terminal or you're doing Tools > Start SSH Session... > etc?
– Ástþór
Nov 12 at 10:36
@Ástþór, as far as I know, PhpStorm uses an interpreter, which I set in project settings. In my case, it uses interpreter from docker container, on my workstation no PHP installed. According to your second question, firstly I execute commanddocker exec -u www-data -it docker_php_1 /bin/bash
and only then I execute command./yii analysis/start-charts ...
– Nikita Leshchev
Nov 14 at 9:22
add a comment |
Running it in PhpStorm equals running it using your machine's terminal: the command isn't run inside of a container. I would assume that running./yii analysis/start-charts 003b56fe-db47-11e8-bcc0-52540010e5bc 205
in a console of your workstation would also fail? Btw, are you running this command simply in Terminal or you're doing Tools > Start SSH Session... > etc?
– Ástþór
Nov 12 at 10:36
@Ástþór, as far as I know, PhpStorm uses an interpreter, which I set in project settings. In my case, it uses interpreter from docker container, on my workstation no PHP installed. According to your second question, firstly I execute commanddocker exec -u www-data -it docker_php_1 /bin/bash
and only then I execute command./yii analysis/start-charts ...
– Nikita Leshchev
Nov 14 at 9:22
Running it in PhpStorm equals running it using your machine's terminal: the command isn't run inside of a container. I would assume that running
./yii analysis/start-charts 003b56fe-db47-11e8-bcc0-52540010e5bc 205
in a console of your workstation would also fail? Btw, are you running this command simply in Terminal or you're doing Tools > Start SSH Session... > etc?– Ástþór
Nov 12 at 10:36
Running it in PhpStorm equals running it using your machine's terminal: the command isn't run inside of a container. I would assume that running
./yii analysis/start-charts 003b56fe-db47-11e8-bcc0-52540010e5bc 205
in a console of your workstation would also fail? Btw, are you running this command simply in Terminal or you're doing Tools > Start SSH Session... > etc?– Ástþór
Nov 12 at 10:36
@Ástþór, as far as I know, PhpStorm uses an interpreter, which I set in project settings. In my case, it uses interpreter from docker container, on my workstation no PHP installed. According to your second question, firstly I execute command
docker exec -u www-data -it docker_php_1 /bin/bash
and only then I execute command ./yii analysis/start-charts ...
– Nikita Leshchev
Nov 14 at 9:22
@Ástþór, as far as I know, PhpStorm uses an interpreter, which I set in project settings. In my case, it uses interpreter from docker container, on my workstation no PHP installed. According to your second question, firstly I execute command
docker exec -u www-data -it docker_php_1 /bin/bash
and only then I execute command ./yii analysis/start-charts ...
– Nikita Leshchev
Nov 14 at 9:22
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
accepted
I've got an answer on "superuser" site: https://superuser.com/questions/1374463/phpstorm-docker-xdebug-db-ssh-tunnel/1375961#1375961
Besides, I've added ports
node to my php
container definition, now it's the following:
php:
build:
context: ./php
volumes:
- ./../:/home/web/my-website.com/
working_dir: /home/web/my-website.com/
expose:
- "8123"
ports:
- "8123:8123"
depends_on:
- redis
- mysql
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
accepted
I've got an answer on "superuser" site: https://superuser.com/questions/1374463/phpstorm-docker-xdebug-db-ssh-tunnel/1375961#1375961
Besides, I've added ports
node to my php
container definition, now it's the following:
php:
build:
context: ./php
volumes:
- ./../:/home/web/my-website.com/
working_dir: /home/web/my-website.com/
expose:
- "8123"
ports:
- "8123:8123"
depends_on:
- redis
- mysql
add a comment |
up vote
0
down vote
accepted
I've got an answer on "superuser" site: https://superuser.com/questions/1374463/phpstorm-docker-xdebug-db-ssh-tunnel/1375961#1375961
Besides, I've added ports
node to my php
container definition, now it's the following:
php:
build:
context: ./php
volumes:
- ./../:/home/web/my-website.com/
working_dir: /home/web/my-website.com/
expose:
- "8123"
ports:
- "8123:8123"
depends_on:
- redis
- mysql
add a comment |
up vote
0
down vote
accepted
up vote
0
down vote
accepted
I've got an answer on "superuser" site: https://superuser.com/questions/1374463/phpstorm-docker-xdebug-db-ssh-tunnel/1375961#1375961
Besides, I've added ports
node to my php
container definition, now it's the following:
php:
build:
context: ./php
volumes:
- ./../:/home/web/my-website.com/
working_dir: /home/web/my-website.com/
expose:
- "8123"
ports:
- "8123:8123"
depends_on:
- redis
- mysql
I've got an answer on "superuser" site: https://superuser.com/questions/1374463/phpstorm-docker-xdebug-db-ssh-tunnel/1375961#1375961
Besides, I've added ports
node to my php
container definition, now it's the following:
php:
build:
context: ./php
volumes:
- ./../:/home/web/my-website.com/
working_dir: /home/web/my-website.com/
expose:
- "8123"
ports:
- "8123:8123"
depends_on:
- redis
- mysql
answered Nov 17 at 9:38
Nikita Leshchev
1,057620
1,057620
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53249075%2fphpstorm-docker-xdebug-db-ssh-tunnel%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Running it in PhpStorm equals running it using your machine's terminal: the command isn't run inside of a container. I would assume that running
./yii analysis/start-charts 003b56fe-db47-11e8-bcc0-52540010e5bc 205
in a console of your workstation would also fail? Btw, are you running this command simply in Terminal or you're doing Tools > Start SSH Session... > etc?– Ástþór
Nov 12 at 10:36
@Ástþór, as far as I know, PhpStorm uses an interpreter, which I set in project settings. In my case, it uses interpreter from docker container, on my workstation no PHP installed. According to your second question, firstly I execute command
docker exec -u www-data -it docker_php_1 /bin/bash
and only then I execute command./yii analysis/start-charts ...
– Nikita Leshchev
Nov 14 at 9:22