Docker container running but connection reset on browser Apache - php

I had my Docker setup yesterday with Apache PHP with a single index.php file to run "hello world" and it was working properly. But today out of nowhere, it has started to misbehave.
Here is my very simple docker-compose.yml:
version: '3'
services:
db:
image: mysql:5.7
environment:
MYSQL_ROOT_PASSWORD: my_secret_pw_shh
MYSQL_DATABASE: test_db
MYSQL_USER: devuser
MYSQL_PASSWORD: devpass
ports:
- "9906:3306"
web:
image: php:7.2.2-apache
container_name: php_web
depends_on:
- db
volumes:
- ./php/:/var/www/html/
ports:
- "8100:80"
stdin_open: true
tty: true
The issue that I'm facing is that, when I browse localhost:8100, it shows connection is reset. I don't have any application engaging this port 8100. Moreover, after a lot of failed research I managed to find out that Docker has it's own IP address inside the container and it exposes IP outside to get itself connected. However, I tried using network_mode to host as well but no luck.
I can share logs, which of no use as there are no errors they are really simple as it should be. There is not breaking in Apache config, the issue seems to be in IP mapping.
I've also looked docker network inspect {{network_name}} but no luck. I noticed that each Docker image creates the it's network during the first build. I'd like you to see:
docker network inspect test_default
[
{
"Name": "test_default",
"Id": "018e7845456beaabee1cd729da9c1d14440f13f93f4f606f700ff0013804246d",
"Created": "2022-02-03T23:51:25.740391332+05:00",
"Scope": "local",
"Driver": "bridge",
"EnableIPv6": false,
"IPAM": {
"Driver": "default",
"Options": null,
"Config": [
{
"Subnet": "172.23.0.0/16",
"Gateway": "172.23.0.1"
}
]
},
"Internal": false,
"Attachable": true,
"Ingress": false,
"ConfigFrom": {
"Network": ""
},
"ConfigOnly": false,
"Containers": {},
"Options": {},
"Labels": {
"com.docker.compose.network": "default",
"com.docker.compose.project": "test",
"com.docker.compose.version": "1.29.2"
}
}
]
This is the output of network of my container.
I tried creating custom network following tutorial on Docker but still no luck.
After a bit of research, I also got to know if the IPs that are assigned to docker0 are colliding with some of my other gateways, then it happens which I didn't notice that any ip-address range is being collided.
In case you ask for my bridge IP here it is:
docker network inspect bridge
[
{
"Name": "bridge",
"Id": "12b99dd622ac5d09e45cf935cc2db907b4249140bbd2fb397db5dc81a1d70ab0",
"Created": "2022-02-03T22:03:26.564919187+05:00",
"Scope": "local",
"Driver": "bridge",
"EnableIPv6": false,
"IPAM": {
"Driver": "default",
"Options": null,
"Config": [
{
"Subnet": "172.17.0.0/16",
"Gateway": "172.17.0.1"
}
]
},
"Internal": false,
"Attachable": false,
"Ingress": false,
"ConfigFrom": {
"Network": ""
},
"ConfigOnly": false,
"Containers": {},
"Options": {
"com.docker.network.bridge.default_bridge": "true",
"com.docker.network.bridge.enable_icc": "true",
"com.docker.network.bridge.enable_ip_masquerade": "true",
"com.docker.network.bridge.host_binding_ipv4": "0.0.0.0",
"com.docker.network.bridge.name": "docker0",
"com.docker.network.driver.mtu": "1500"
},
"Labels": {}
}
]
And my system netstat -nr shows this result:
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 wlp0s20f3
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 br-4c91e6855bcb
172.17.0.0 0.0.0.0 255.255.0.0 U 0 0 0 docker0
172.18.0.0 0.0.0.0 255.255.0.0 U 0 0 0 br-4c91e6855bcb
172.19.0.0 0.0.0.0 255.255.0.0 U 0 0 0 br-9711f2bb8edf
172.22.0.0 0.0.0.0 255.255.0.0 U 0 0 0 br-2211a05bcc3d
172.23.0.0 0.0.0.0 255.255.0.0 U 0 0 0 br-018e7845456b
172.28.0.0 0.0.0.0 255.255.0.0 U 0 0 0 br-55c64ea21f40
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 wlp0s20f3
asad#sav-dev--asad:/var/www/test$
I used the following commands,
netstat -nr for all
docker network inspect bridge
^^ FOR MY BRIDGE NETWORK
Everything seems fine but what happened all of a sudden that it has stopped working. Apache is running with no issues, here are the logs:
8aa94fcb082a_php_web | AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.23.0.3. Set the 'ServerName' directive globally to suppress this message
8aa94fcb082a_php_web | AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.23.0.3. Set the 'ServerName' directive globally to suppress this message
8aa94fcb082a_php_web | [Thu Feb 03 20:20:54.830485 2022] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.25 (Debian) PHP/7.2.2 configured -- resuming normal operations
8aa94fcb082a_php_web | [Thu Feb 03 20:20:54.830543 2022] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
I read somewhere to curl the IP inside the container, but the responses from inside the container weren't also up to the mark. They were refusing the connection.
When I do my docker-compose up and the written port gets engaged I get this.
sudo netstat -pna | grep 8100
tcp 0 0 0.0.0.0:8100 0.0.0.0:* LISTEN 1123608/docker-prox
tcp6 0 0 :::8100 :::* LISTEN 1123617/docker-prox
otherwise I don't.
P.S: I tried reinstalling docker-compose, and Docker engine twice, rebuilding image, removing containers etc. but it didn't help me.

Related

Laravel Sail - Migration are working but can't register new user

I've set up a new laravel project and here's the step I followed :
install laravel on docker using
curl -s "https://laravel.build/example-app" | bash
changing mysql port as 3306 is already used in my machine. Files have changed
.env file
DB_CONNECTION=mysql
DB_HOST=0.0.0.0
DB_PORT=4306
DB_DATABASE=example_app
DB_USERNAME=sail
DB_PASSWORD=password
docker-compose file (mysql container section)
mysql:
image: 'mysql/mysql-server:8.0'
ports:
- '${FORWARD_DB_PORT:-4306}:3306'
environment:
MYSQL_ROOT_PASSWORD: '${DB_PASSWORD}'
MYSQL_ROOT_HOST: "%"
MYSQL_DATABASE: '${DB_DATABASE}'
MYSQL_USER: '${DB_USERNAME}'
MYSQL_PASSWORD: '${DB_PASSWORD}'
MYSQL_ALLOW_EMPTY_PASSWORD: 1
volumes:
- 'sail-mysql:/var/lib/mysql'
- './vendor/laravel/sail/database/mysql/create-testing-database.sh:/docker-entrypoint-initdb.d/10-create-testing-database.sh'
networks:
- sail
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-p${DB_PASSWORD}"]
retries: 3
timeout: 5s
build and run container
./vendor/bin/sail up
run 1st migration
Everything works fine at this point.
Then I install breeze package and run the migration
composer require laravel/breeze && php artisan migrate
Everything is still working at this point.
Then when I try to register a new user entering the adress localhost/register, I get the following error
lluminate \ Database \ QueryException
SQLSTATE[HY000] [2002] Connection refused
select count(*) as aggregate from `users` where `email` = my_new_user#test.com
Am I missing something in the .env or the docker-compose.yml ?
Thanks a lot
I found a fix by changing the environment variable with the Gateway IP
Use this command to find this IP
docker network inspect bridge
you should have a result like the following :
[
{
"Name": "bridge",
"Id": "17da7215587ae714f631d213fed173550b69d38a5824c1998e1c3cd4b2e954b",
"Created": "2022-10-26T19:26:38.585884296Z",
"Scope": "local",
"Driver": "bridge",
"EnableIPv6": false,
"IPAM": {
"Driver": "default",
"Options": null,
"Config": [
{
"Subnet": "172.17.0.0/16",
"Gateway": "172.17.0.1"
}
]
},
"Internal": false,
"Attachable": false,
"Ingress": false,
"ConfigFrom": {
"Network": ""
},
"ConfigOnly": false,
"Containers": {},
"Options": {
"com.docker.network.bridge.default_bridge": "true",
"com.docker.network.bridge.enable_icc": "true",
"com.docker.network.bridge.enable_ip_masquerade": "true",
"com.docker.network.bridge.host_binding_ipv4": "0.0.0.0",
"com.docker.network.bridge.name": "docker0",
"com.docker.network.driver.mtu": "1500"
},
"Labels": {}
}
]
use the Gateway entry in your .env file

docker containers can't talk to each other

I have 3 docker containers that are supposed to talk to each other. A very classic stack with nginx, php-fpm and mariadb.
My stack used to work, but now my containers can't seem to talk to each other anymore, and I don't know what changed. The nginx can't talk to the php-fpm, and the php-fpm can't talk to mariadb.
Here is the docker-compose I use :
version: '3'
services:
web-nginx:
image: nginx:stable-alpine
container_name: web-nginx
restart: always
ports:
- "80:80"
web-php:
restart: always
build:
context: ./php
dockerfile: Dockerfile
container_name: web-php
web-mariadb:
build:
context: ./mariadb
dockerfile: Dockerfile
restart: always
container_name: web-mariadb
ports:
- "3306:3306"
The content of docker-compose ps :
docker-compose ps
Name Command State Ports
-----------------------------------------------------------------------------
web-mariadb docker-entrypoint.sh mysqld Up 0.0.0.0:3306->3306/tcp
web-nginx /docker-entrypoint.sh ngin ... Up 0.0.0.0:80->80/tcp
web-php docker-php-entrypoint php-fpm Up 9000/tcp
My DockerFiles :
FROM php:fpm-alpine
ENV USER=docker
ENV UID=1000
RUN adduser \
--disabled-password \
--gecos "" \
--home "$(pwd)" \
--no-create-home \
--uid "$UID" \
"$USER"
[...]
USER docker
FROM mariadb
RUN echo max_allowed_packet=512M >> /etc/mysql/my.cnf
The nginx.conf file
[...]
http {
[...]
server {
listen 80;
server_name localhost;
location / {
root /usr/share/nginx/html;
index index.php index.html index.htm;
}
location ~ \.php$ {
root /usr/share/nginx/html;
include fastcgi_params;
fastcgi_pass web-php:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /script$fastcgi_script_name;
}
}
}
So my php-fpm is supposed to be accessed through port 9000 while mariadb listens to the classical 3306.
Between containers, ping commands are OK, but nc are not (I use nc because telnet is not bundled in alpine images):
docker exec -u 0 -it web-nginx sh #I use -u 0 to be root because otherwise ping is not allowed in the container
/ # ping -c1 web-php
PING web-php (172.22.0.3): 56 data bytes
64 bytes from 172.22.0.3: seq=0 ttl=64 time=0.156 ms
--- web-php ping statistics ---
1 packets transmitted, 1 packets received, 0% packet loss
round-trip min/avg/max = 0.156/0.156/0.156 ms
/ # nc -v web-php 9000
nc: web-php (172.22.0.3:9000): Host is unreachable
docker exec -u 0 -it web-php sh
ping -c1 web-mariadb
PING web-mariadb (172.22.0.4): 56 data bytes
64 bytes from 172.22.0.4: seq=0 ttl=64 time=0.199 ms
--- web-mariadb ping statistics ---
1 packets transmitted, 1 packets received, 0% packet loss
round-trip min/avg/max = 0.199/0.199/0.199 ms
/var/www/html # nc -v web-mariadb 3306
nc: web-mariadb (172.22.0.4:3306): Host is unreachable
Here is the docker inspect command :
[
{
"Name": "web_default",
"Id": "e458e63d89e3f6e2c35644aa03f377dc9fba6975b4b8838727b85c57c3b183ba",
"Created": "2021-01-28T15:00:06.814105722+01:00",
"Scope": "local",
"Driver": "bridge",
"EnableIPv6": false,
"IPAM": {
"Driver": "default",
"Options": null,
"Config": [
{
"Subnet": "172.22.0.0/16",
"Gateway": "172.22.0.1"
}
]
},
"Internal": false,
"Attachable": true,
"Ingress": false,
"ConfigFrom": {
"Network": ""
},
"ConfigOnly": false,
"Containers": {
"af441d802fd26173ea98ca81b85eb48cbea36b65b867df46b6ddb2f5ac484816": {
"Name": "web-nginx",
"EndpointID": "6b69e2033b3de50c86161cbec103843de5f83ab53ecebd557ff66ae57adaae04",
"MacAddress": "02:42:ac:16:00:02",
"IPv4Address": "172.22.0.2/16",
"IPv6Address": ""
},
"be99788a48d03fb51288aab6373596c41ed8adcbcf8ceaa8ae2ece1e0aa10843": {
"Name": "web-mariadb",
"EndpointID": "8f52e8fe97f24161934b9ab3dcdde9da69aeb80388deb3f6442dd089554e30f0",
"MacAddress": "02:42:ac:16:00:04",
"IPv4Address": "172.22.0.4/16",
"IPv6Address": ""
},
"f1d2aa6a6c2e156416da3ca0424336380b01950d6f0990203a2d0484ad0d04a5": {
"Name": "web-php",
"EndpointID": "7e6b95ccb7da5bcdd3754d1965820e429bdf5370cecee0bceb29c79138d36e0e",
"MacAddress": "02:42:ac:16:00:03",
"IPv4Address": "172.22.0.3/16",
"IPv6Address": ""
}
},
"Options": {},
"Labels": {
"com.docker.compose.network": "default",
"com.docker.compose.project": "web",
"com.docker.compose.version": "1.27.4"
}
}
]
Since ping works between containers, I assume network is correct, but ports are not opened.
Also, I noticed that my containers can't reach internet. Any ping to google or just "outside" is rejected.
I tried restarting the docker service and even reboot my server, but no luck.
I don't know how to troubleshoot this.
Server running centos 8 :
Linux myserver 4.18.0-240.10.1.el8_3.x86_64
Docker version 20.10.2, build 2291f61
Any help much appreciated.
Thanks !

ECS mount volume to nginx container

I am trying to set up ECS in order to run my php/nginx docker application.
It works locally using this docker-compose.yml file:
version: '2'
services:
nginx:
image: NGINX-IMAGE
ports:
- 80:80
links:
- php
volumes_from:
- php
environment:
APP_SERVER_NAME: <ip>
php:
image: PHP-IMAGE
ports:
- 9000:9000
volumes:
- /var/www/html
The problem is that I can't get this working using ECS.
I don't know how to create the web-data volume and let nginx grap it using volumes_from.
I am trying to create the volume using this JSON:
volumes='[
{
"name": "webdata",
"host": {
"sourcePath": "/var/www/html"
}
}
]'
And then in my container-definitions to the php-container I add:
"mountPoints":
[
{
"sourceVolume": "webdata",
"containerPath": "/var/www/html",
"readOnly": false
}
]
However, when I do this, it adds the content from the host's /var/www/html folder to the /var/www/html folder of the containers.
My question is, how do I configure the volume to use the data from the php's /var/www/html container and let nginx access this data?
I managed to find a solution that suited the setup for ECS.
I simply created a VOLUME in my php Dockerfile referencing /var/www/html.
This means I longer need to reference the volume in the volumes section of the php container. And nginx will still be able to access the volume with volumes_from.
Update
This is my working task definition for ECS:
task_template='[
{
"name": "nginx",
"image": "NGINX_IMAGE",
"essential": true,
"cpu": 10,
"memoryReservation": 1000,
"portMappings": [
{
"containerPort": 80,
"hostPort": 80
}
],
"environment" : [
{ "name" : "APP_SERVER_NAME", "value" : "%s" }
],
"links": [
"app"
],
"volumesFrom": [
{ "sourceContainer": "app" }
]
},
{
"name": "app",
"image": "IMAGE",
"essential": true,
"cpu": 10,
"memoryReservation": 1000,
"portMappings": [
{
"containerPort": 9000,
"hostPort": 9000
}
]
}
]'
And then I added VOLUME ["/var/www/html"] to my app Dockerfile. Now nginx can access the data with the volumes_from argument in the task definition.

Docker container connection to gateway refused

While setting up a php dev environment with docker, I ran into an issue while setting up remote debugging (XDEBUG) through a dbgp proxy.
Connecting my host machine to the proxy doesn't seem to be a problem, but the proxy container cannot reach my host machine over the port that is configured (in this case 9003)
I'm using docker compose on windows.
Sucessfully connecting my dev machine to the proxy:
INFO: dbgp.proxy: Server:onConnect ('172.18.0.1', 36558) [proxyinit -p 9003 -k XDEBUG_IDEA -m 1 ]
When executing a request containing the right IDE key (e.g. http://localhost/?XDEBUG_SESSION_START=XDEBUG_IDEA), the proxy reacts correctly but is unable to contact the gateway over the port that was registered by my dev machine)
INFO: dbgp.proxy: connection from 172.18.0.2:40902 [<__main__.sessionProxy instance at 0x7fcff1998998>]
ERROR: dbgp.proxy: Unable to connect to the server listener 172.18.0.1:9003 [<__main__.sessionProxy instance at 0x7fcff1998998>]
Traceback (most recent call last):
File "/usr/local/bin/pydbgpproxy", line 223, in startServer
self._server.connect((self._serverAddr[0], self._serverAddr[1]))
File "/usr/lib/python2.7/socket.py", line 224, in meth
return getattr(self._sock,name)(*args)
error: [Errno 111] Connection refused
WARNING: dbgp.proxy: Unable to connect to server with key [XDEBUG_IDEA], stopping request [<__main__.sessionProxy instance at 0x7fcff1998998>]
INFO: dbgp.proxy: session stopped
Any ideas on what is going wrong here?
Firewall issues can be excluded here, since i basically just turned it of.
I did log into the dbgpproxy container and was able to send requests to the gateway ip over ports 80 an 8080, but got the same connection refused when trying port 9003)
Any pointers would be greatly appreciated!
The docker compose file:
version: '2'
volumes:
mysqldata:
driver: local
services:
app:
restart: "always"
image: php:7.0-fpm
command: "true"
volumes:
- .:/var/www/html
nginx:
restart: "always"
build: ./docker/nginx/
ports:
- "80:80"
depends_on:
- php
php:
restart: "always"
build: ./docker/php/
environment:
XDEBUG_CONFIG: remote_host=dbgpproxy
expose:
- "9000"
depends_on:
- mysql
volumes_from:
- app
composer:
restart: "no"
image: composer/composer:php7
command: install
volumes:
- .:/app
dbgpproxy:
restart: "always"
image: christianbladescb/dbgpproxy
expose:
- "9000"
ports:
- "9001:9001"
environment:
DOCKER_HOST: 10.0.75.1
mysql:
image: mysql:latest
volumes:
- mysqldata:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: secret
MYSQL_DATABASE: project
MYSQL_USER: project
MYSQL_PASSWORD: project
phpmyadmin:
image: phpmyadmin/phpmyadmin
ports:
- 8080:80
depends_on:
- mysql
environment:
PMA_HOST: mysql
redis:
image: redis
ports:
- "6379:6379"
mailcatcher:
image: schickling/mailcatcher
restart: "always"
Docker network info:
[
{
"Name": "test_default",
"Id": "8f5b2e1188d65948d6a46977467b181e7fdb4b112a688ff87691b35c29da8970",
"Scope": "local",
"Driver": "bridge",
"EnableIPv6": false,
"IPAM": {
"Driver": "default",
"Options": null,
"Config": [
{
"Subnet": "172.18.0.0/16",
"Gateway": "172.18.0.1"
}
]
},
"Internal": false,
"Containers": {
"05725540eca07666de250f2bb9ae856da69c0c325c4476150f214ba32a9b8714": {
"Name": "test_nginx_1",
"EndpointID": "723a820ea07e77cf976712293a911be3245e862477af6e0ecdcc1462536de6f5",
"MacAddress": "02:42:ac:12:00:08",
"IPv4Address": "172.18.0.8/16",
"IPv6Address": ""
},
"78085ebed911e767a9c006d909cb245e0392055d37550c6cfa3a618969bef821": {
"Name": "test_dbgpproxy_1",
"EndpointID": "2332e1a01a8c0ec7262d96829d7d8f3cb4c711b6e9033ab85a8dfdb57ae01382",
"MacAddress": "02:42:ac:12:00:0a",
"IPv4Address": "172.18.0.10/16",
"IPv6Address": ""
},
"7e12ea0a3a9b90360be6c15222fd052fbf02065aa18b8a3b12d19779bef4b41b": {
"Name": "test_phpmyadmin_1",
"EndpointID": "456a6508b6a507e01584beaf54eec9605db449261749065a562a6fb62111bb9c",
"MacAddress": "02:42:ac:12:00:05",
"IPv4Address": "172.18.0.5/16",
"IPv6Address": ""
},
"81043a642cd9932e16bc51ba4604f6057d82e2c05f6e7378a85adfaa2de87f28": {
"Name": "test_app_1",
"EndpointID": "cfa41a5f210d4907747dcf7d516c6bdaecb817c993867a1e5f8e0250d33c927b",
"MacAddress": "02:42:ac:12:00:03",
"IPv4Address": "172.18.0.3/16",
"IPv6Address": ""
},
"8b0cd7dc33fb783ae811f7ba15decd0165199da66242a10a33d8ee86c41bd664": {
"Name": "test_mailcatcher_1",
"EndpointID": "f2ed38e42dffd9565822a7ac248dcb022a47c8a78b05e93793b62d7188d0823c",
"MacAddress": "02:42:ac:12:00:06",
"IPv4Address": "172.18.0.6/16",
"IPv6Address": ""
},
"d552bf1ab3914220b8fbf9961cc3801acbe180c6e945bd0b4c3bcf8588352a5d": {
"Name": "test_mysql_1",
"EndpointID": "6188cbeb49cf8afc2a7622bd6ef7fc7076ea91b909ec3efc1d9a1ed1d35d5790",
"MacAddress": "02:42:ac:12:00:04",
"IPv4Address": "172.18.0.4/16",
"IPv6Address": ""
},
"ecc941fc337d727e3c118bf9112dee1552ef5db7c94b24706c7d03bc42ea6c0a": {
"Name": "test_redis_1",
"EndpointID": "3f4254982ed1be8354f514dd717993e02b4afdfad8d022f5f8daf0b919a852e1",
"MacAddress": "02:42:ac:12:00:07",
"IPv4Address": "172.18.0.7/16",
"IPv6Address": ""
},
"f15f53405205db7263013fbb1ef1272764ca16850a46097b23d3619cd3d37b20": {
"Name": "test_php_1",
"EndpointID": "5fe30610823cd5660bf62e7612007ff4eef0316cbdfd15dbc0e56cafa6a3aca7",
"MacAddress": "02:42:ac:12:00:02",
"IPv4Address": "172.18.0.2/16",
"IPv6Address": ""
}
},
"Options": {},
"Labels": {}
}
]
That's because pydbgpproxy works similar to XDebug and it is trying to connect to the wrong IP address. The correct IP address pydbgpproxy should connect to is host.docker.internal.
Situation:
xDebug ---> pydbgpproxy -X-> Host
This is because pydbgpproxy received the wrong IP from Docker in the first place.
So I guess you have to hardcode the host.docker.internal IP into pydbgpproxy

Debugging not starting

UPDATE:
I've spent way too much time on this and have decided to ditch it and continue using the clunky NetBeans.
ORIGINAL QUESTION:
I'm having some difficulty getting xdebug to work with sublime text 2.
What I have done so far is install:
LAMP,
php5-xdebug
python2.6
sublime-text-2
sublimexdebug
If I then use sublime to open a php file and press shift+f8, the xdebug menu pops up from which I can add/remove breakpoint and also start debugging.
Some php:
Menu drops down when I press shift+f8:
Debugging started:
In that image it says:
Xdebug: No URL defined in project settings file
Info.sublime-project contains:
{
"folders":
[
{
"path": "/var/www"
}
],
"settings": {
"xdebug": { "url": "http://localhost" }
}
}
As you can see from the 3rd screenshot, I have started debugging and nothing happens, no errors, no browser window opens, nothing. If I manually navigate to localhost/info.php, the page loads as normal. If I manually add ?XDEBUG_SESSION_START=sublime.xdebug to the end of the url so localhost/info.php?XDEBUG_SESSION_START=sublime.xdebug and hit refresh on the browser, the page loads as normal and debugging still doesn't start.
What am I doing wrong?
UPDATE: Some info about ports:
Before trying to start xdebug via sublime text 2
oshirowanen#ubuntu:~$ netstat -antp
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:53 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN -
tcp 0 0 90.190.20.220:54913 90.180.80.70:443 ESTABLISHED 2439/python
tcp 0 0 90.190.20.220:51727 190.40.210.160:443 TIME_WAIT -
tcp 1 0 90.190.20.220:50967 90.180.90.20:80 CLOSE_WAIT 2349/ubuntu-geoip-p
tcp6 0 0 :::80 :::* LISTEN -
oshirowanen#ubuntu:~$
After starting chromium manually and starting xdebug via sublime text 2
oshirowanen#ubuntu:~$ netstat -antp
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:17500 0.0.0.0:* LISTEN 2241/dropbox
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:53 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:59424 127.0.0.1:80 ESTABLISHED 2924/chromium-brows
tcp 0 0 127.0.0.1:43123 127.0.0.1:9000 ESTABLISHED -
tcp 0 0 127.0.0.1:9000 127.0.0.1:43123 ESTABLISHED 2903/sublime_text
tcp 0 0 90.190.20.220:40809 170.190.40.70:443 ESTABLISHED 2924/chromium-brows
tcp 0 0 90.190.20.220:54913 90.180.80.70:443 ESTABLISHED 2439/python
tcp 0 0 90.190.20.220:43900 170.190.70.90:443 ESTABLISHED 2924/chromium-brows
tcp 0 0 90.190.20.220:35259 170.190.70.100:443 ESTABLISHED 2924/chromium-brows
tcp 0 0 127.0.0.1:59426 127.0.0.1:80 TIME_WAIT -
tcp 0 0 90.190.20.220:37922 170.190.70.90:443 ESTABLISHED 2924/chromium-brows
tcp 1 0 90.190.20.220:50967 90.180.90.20:80 CLOSE_WAIT 2349/ubuntu-geoip-p
tcp 0 0 90.190.20.220:40847 170.190.40.60:80 ESTABLISHED 2924/chromium-brows
tcp6 0 0 :::80 :::* LISTEN -
tcp6 0 0 127.0.0.1:80 127.0.0.1:59423 TIME_WAIT -
tcp6 0 0 127.0.0.1:80 127.0.0.1:59424 ESTABLISHED -
oshirowanen#ubuntu:~$
Some tips:
Check that Xdebug is running checking the information generated by the phpinfo command.
Enable remote debugging in the xdebug configuration (and verify again with the phpinfo command):
xdebug.remote_enable=1
I don't use the xdebug setting in Sublime Text. I think it is not necessary.
Open the console in Sublime Text. Any problem is logged in the console. There are some problems in Ubuntu reported in the pulgin homepage.
I use a browser extension to activate or deactivate the debugging. In Chrome look for "Xdebug Helper for Chrome". You need to configure the cookie name as "sublime.xdebug".
I use Easy xDebug for firefox to kick start the debug session and that works a charm. You need to use "sublime.xdebug" for the idekey.
I presume that you've got some break points in there? Your screenshots imply that you do but make sure that you use the shift+f8 menu to add them.
You have got a problem in your configuration, it is using the wrong syntax (according to Issue #13):
{
"folders":
[
{
"path": "/var/www"
}
],
"settings": { <<<==== problem here
"xdebug": { "url": "http://localhost" }
}
}
Instead it should be:
{
"folders":
[
{
"path": "/var/www"
}
],
"xdebug":
{
"url": "http://localhost"
}
}
This is probably also causing it not working.
I experienced the same issue and submitted bug report here:
https://github.com/Kindari/SublimeXdebug/issues/58
However, it may be socket related bug in XDebug itself:
http://forums.netbeans.org/viewtopic.php?p=141779#141779

Categories