I'm on macOS Sonoma, using the latest Docker Desktop for Mac, and the latest version of PhpStorm.
I followed the guide to install the Workshop from within PhpStorm:
As instructed, I edited the docker-compose.yml to uncomment:
XDEBUG_CONFIG: remote_host=host.docker.internal
and
- /tmp:/home/jetbrains/upload
I ran the project as instructed, but this fails on an ARM processor Mac as the images are all Intel-based.
I then tried on an Intel Mac (again, latest Docker & PhpStorm) and I am at least able to build the project and it appears to run.
The docker-compose.yml appears to suggest I should be able to reach the project on port 8081 but this also fails:
The logs say:
[Mon Oct 09 23:47:24.636827 2023] [autoindex:error] [pid 18] [client 192.168.65.1:30717] AH01276: Cannot serve directory /var/www/html/: No matching DirectoryIndex (index.php,index.html) found, and server-generated directory index forbidden by Options directive
2023-10-09T23:47:24.637237955Z 192.168.65.1 - - [09/Oct/2023:23:47:24 +0000] "GET / HTTP/1.1" 403 493 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:109.0) Gecko/20100101 Firefox/118.0"
Later in the Debug your application section of the guide:
This is incorrect. There is no such interpreter automatically configured (that would require PhpStorm to create an .idea folder with the interpreter already configured when generating the Workshop, right?):
I then attempt to create an interpreter, although the guide is no help at this point since it assumes it was automatically created:
Creating an interpreter which points at the php in the docker container is not enough. It appears a Run configuration needs to be created as well, and requires pointing the Run configuration at the exact same docker-compose.yml used when creating the interpreter:
After attempting to run the docker compose project, I was prompted with this:
There are no options for telling PhpStorm to get the phpinfo() from the interpreter I've already configured. Given that I can't actually run this project, I can't copy and paste it either.
I stumbled upon this tutorial project after wasting time trying to get PhpStorm & xdebug working in a docker compose environment. The PhpStorm documentation is very fragmented and doesn't walk someone through a full working example for a docker compose-based setup. It's a shame that this official tutorial doesn't work either.
What is the right way to spin up a docker compose environment, configure PhpStorm to run the docker compose containers, and connect to xdebug for debugging?
I'm on macOS Sonoma, using the latest Docker Desktop for Mac, and the latest version of PhpStorm.
I followed the guide to install the Workshop from within PhpStorm:
As instructed, I edited the
docker-compose.ymlto uncomment:and
I ran the project as instructed, but this fails on an ARM processor Mac as the images are all Intel-based.
I then tried on an Intel Mac (again, latest Docker & PhpStorm) and I am at least able to build the project and it appears to run.
The docker-compose.yml appears to suggest I should be able to reach the project on port
8081but this also fails:The logs say:
Later in the Debug your application section of the guide:
This is incorrect. There is no such interpreter automatically configured (that would require PhpStorm to create an
.ideafolder with the interpreter already configured when generating the Workshop, right?):I then attempt to create an interpreter, although the guide is no help at this point since it assumes it was automatically created:
Creating an interpreter which points at the php in the docker container is not enough. It appears a Run configuration needs to be created as well, and requires pointing the Run configuration at the exact same docker-compose.yml used when creating the interpreter:
After attempting to run the docker compose project, I was prompted with this:
There are no options for telling PhpStorm to get the
phpinfo()from the interpreter I've already configured. Given that I can't actually run this project, I can't copy and paste it either.I stumbled upon this tutorial project after wasting time trying to get PhpStorm & xdebug working in a
docker composeenvironment. The PhpStorm documentation is very fragmented and doesn't walk someone through a full working example for adocker compose-based setup. It's a shame that this official tutorial doesn't work either.What is the right way to spin up a docker compose environment, configure PhpStorm to run the
docker composecontainers, and connect to xdebug for debugging?