Skip to content

Poor developer experience when PhpStorm doesn't work out of the box #82

@jsma

Description

@jsma

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:

Screenshot 2023-10-09 at 10 02 53 PM

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:

Screenshot 2023-10-09 at 4 47 43 PM

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:

Screenshot 2023-10-09 at 7 43 55 PM

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?):

Screenshot 2023-10-09 at 5 52 47 PM

I then attempt to create an interpreter, although the guide is no help at this point since it assumes it was automatically created:

Screenshot 2023-10-09 at 5 53 19 PM Screenshot 2023-10-09 at 5 53 51 PM

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:

Screenshot 2023-10-09 at 5 55 20 PM

After attempting to run the docker compose project, I was prompted with this:

Screenshot 2023-10-09 at 4 46 49 PM

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions