docker-for-mac-with-PhpStorm-xdebug
├── apache
| └── default.conf
├── apt
| └── source.list
├── .gitignore
├── docker-compose.yml
├── Dockerfile
├── index.php
└── README.md
- mkdir docker-for-mac-with-PhpStorm-xdebug && cd docker-for-mac-with-PhpStorm-xdebug
- git clone [email protected]:demotascha/docker-for-mac-with-PhpStorm-xdebug.git
- Get docker for Mac(stable), https://docs.docker.com/docker-for-mac/
- check your localhost port 80 used or not. if yes, please stop service.
- follow this article Docker (Mac) De-facto Standard Host Address Alias make address alias.
sudo ifconfig lo0 alias 10.254.254.254
sudo curl -o /Library/LaunchDaemons/com.ralphschindler.docker_10254_alias.plist https://gist.githubusercontent.com/ralphschindler/535dc5916ccbd06f53c1b0ee5a868c93/raw/com.ralphschindler.docker_10254_alias.plist
- vim /etc/hosts
127.0.0.1 www.demo.local.tw
- cd docker-for-mac-with-PhpStorm-xdebug
- docker-compose build && docker-compose up -d
- docker-compose ps
- using PHPStorm to open
docker-for-mac-with-PhpStorm-xdebug
project - set PhpStorm config
- click index.php
- set a breakpoint in the source code
- start listening for PHP debug connections
- open your browser, with link
http://www.demo.local.tw