PhpStorm can't find Docker PHP for image

When trying to add Flywheel as a remote CLI Interpreter in PhpStorm, it gives me the choice between custom:1.2 and flywheel:1.0 for image names. Selecting the flywheel image gives me access to PHP 5.6, but choosing the custom one throws an error instead of giving me the PHP version I’ve selected in Local for my site.

PhpStorm appears to run docker exec to query the container for PHP, which throws an error. When I run it in a terminal, I get this, which matches the runtime error PhpStorm throws.

$ docker run custom:1.2 php -v
container_linux.go:247: starting container process caused "exec: \"php\": executable file not found in $PATH"
docker: Error response from daemon: oci runtime error: container_linux.go:247: starting container process caused "exec: \"php\": executable file not found in $PATH".
ERRO[0000] error getting events from daemon: context canceled

If I run docker exec image_name php -v with the name of a running image, it shows me the PHP version I expect to see from the container.
Running docker run flywheel:1.0 php -v returns PHP 5.6.20 no matter what I’ve picked for my site.

Hi Morgan,

The Preferred/Flywheel environment has PHP baked in by default.

The Custom environment on the other hand, copies PHP in when you create the site. This is what the “Provisioning” step is.

You might be able to run the Docker commit command on an existing site using the Custom environment to save it as an image. Then, you can use the newly created image and it’ll have whatever PHP version you selected :slight_smile:

I get that the preferred environment has PHP 5.6 (even though Flywheel’s default is 7.1 now), but it’s weird that I can only partially use the custom image. This may just be a concern with how PhpStorm looks at images, since it’s trying to run a new one each time instead of using the one that’s already provisioned.

I’ll try saving the custom image with the PHP version I want as suggested and see if that helps with the IDE being able to use it.