This demo is to show how to test the Swoole debugger yasd with Phpstorm.
- In Phpstorm, please
- Update Xdebug settings under Languages & Frameworks > PHP > Debug > Xdebug:
- Debug port:
9000 - Option "can accept external connections" is checked.
- Debug port:
- Add a new server
- Name: demo
- Host: 127.0.0.1
- Port: 80
- Debugger: Xdebug
- Check checkbox "Use path mapping", and map the root directory of this repository to
/var/www(the absolute path on the server).
- Update Xdebug settings under Languages & Frameworks > PHP > Debug > Xdebug:
- In Phpstorm, add some breakpoints in file server.php.
- Enable option "Start listening for PHP Debug connections" in Phpstorm.
- We use port
9000on the host for debugging. Please make sure it's not used by any other processes. You can use commandlsof -i :9000to check which program is using port9000. - Use command
docker-compose upordocker-compose up -dto start the container.- In file docker-compose.yml, Docker environment variable
PHP_IDE_CONFIGis set toserverName=demoin the container.demois the server name set in Phpstorm.
- In file docker-compose.yml, Docker environment variable
- After the container is started, you can use command
php --ri yasdin the container to check yasd settings. - Visit URL
http://127.0.0.1in your browser to start debugging.
# To start the container
docker-compose up
# (Optional) To build the Docker image.
docker build -t deminy/yasd-demo .docker exec -ti $(docker ps -qf "name=app") env | grep PHP_IDE_CONFIG
docker exec -ti $(docker ps -qf "name=app") php --ri yasd
docker exec -ti $(docker ps -qf "name=app") cat /usr/local/etc/php/conf.d/docker-php-ext-yasd.ini
docker exec -ti $(docker ps -qf "name=app") tail -f debug.log # Only when option "yasd.log_level" is set to 0.
docker exec -ti $(docker ps -qf "name=app") sh # To get access to a shell
