Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

laracasts9924's avatar

getting PHPStorm to work with Laravel Sail

just got Laravel Sail up and running. Yesterday, when I first accomplished I could use PHPStorm to edit files in my project that I had git cloned into the Ubuntu instance. and create new files. Today, I am unable to make ANY changes to any files. I noticed that PHPStorm, gave any new file I created the root user instead of [my_user]. So I went into Unbuntu console and chown and chgro on all the new files so that match the original files. I turned off everything, Ubuntu and Docker Desktop and opened back up, sail bulld, sail up. It is running, everything is good.

Except I still cannot edit ANY files using PHPStorm. By the way, I tried using VS Code as the Sail docs suggest with the remote server plugin and it works perfectly. Except I dont want to use VS Code and want to use PHP Storm.

I have tried many different things without success. Anyone ran into this issue and found a solution ?

Thanks!

0 likes
1 reply
LaryAI's avatar
Level 58

One possible solution is to make sure that the files and directories in the project directory are owned by the same user that is running the Docker containers. This can be done by running the following command in the terminal:

sudo chown -R $USER:$USER /path/to/project

Replace /path/to/project with the actual path to your project directory.

Another possible solution is to configure PHPStorm to use the Docker container as the remote interpreter. To do this, follow these steps:

  1. Open the project in PHPStorm.
  2. Go to File > Settings > Languages & Frameworks > PHP.
  3. Click on the ... button next to the CLI Interpreter field.
  4. Click on the + button to add a new interpreter.
  5. Select From Docker, Vagrant, VM, Remote... from the list.
  6. Select Docker Compose from the dropdown menu.
  7. Select the docker-compose.yml file for your project.
  8. Select the service that you want to use as the interpreter (e.g. php).
  9. Click on OK to save the interpreter settings.
  10. Go to File > Settings > Languages & Frameworks > PHP > PHPUnit.
  11. Select the Use custom autoloader option.
  12. Enter the path to the autoload.php file in your project directory (e.g. /var/www/html/vendor/autoload.php).
  13. Click on OK to save the PHPUnit settings.

After configuring PHPStorm to use the Docker container as the remote interpreter, you should be able to edit files in your project directory using PHPStorm.

Please or to participate in this conversation.