[Bug]: WSL
a-rehak opened this issue · 9 comments
Short bug description
When I try to run tinker from within docker container, it takes project path from wsl.
Extended bug description
I have a setup where I am using Windows 10 and working on projects stored on a WSL Debian machine. Then I am running Docker desktop where I have my docker services with the development environment.
In phpstorm I have defined php interpreter from within the docker container and correct project mappings into the container. In the tools sectionm Laravel Tinker - Project Settings I have to define the Laravel root folder and Vendor root folder. The problem is it wont take the folder path from "within" the container. It takes the path from within the WSL machine and it does not make path remapping correctly. So when trying to execute tinker code with PHP interpreter inside the docker container I get the:
// Laravel Tinker started at 2023-09-11 13:48:12
require(//wsl$/Debian/usr/local/src/company/ods-data-pump/vendor/autotoad.php):
PHP Warning:
Failed to open stream: No such file or directory in Command line code on line 9
Uncaught Error: Failed opening required '//wsl$/Debian/usr/local/src/company/ods-data-pump/vendor/autotoad.php' . :/usr/share/php') in Command line code:9
Stack trace:
#0 {main}
thrown in Command line code on line 9
*** Execution finished
Which is correct because from within the docker container that parth does not exist....
Your project is not the problem
- I tried using a fresh laravel install - I'm fairly certain it has nothing to do with my project.
How to reproduce?
- Windows 10 machine
- WSL Debian distro
- Laravel projcet root stored on the WSL
- Docker desktop installation
- Laravel docker container with folder mapping into the docker container from within WSL
- phpstorm configure php interpreter for the project inside the docker container
- setup tinker plugin folder locations
- try to execute any tinker code
Expected behavior
Either tinker plugin will allow to specify folder locations from within the container or it will perform correct filepath transformations based on the interpreter path mappings.
Screenshots
No response
IDE & Version
PhpStorm 2023.2.1 Build #PS-232.9559.64, built on August 25, 2023
PHP Version
8.2
OS and version
Windows 10
Laravel Tinker plugin version
2.6.1
Interpreter type
Docker (NOT compose)
Laravel Version
10.19
Tinker version
v2.8.1
Psysh version
v0.11.20
Additional Context
No response
So, the settings feed these paths into the docker container. So, these path should be set the the path where your php files are located in the environment where PHP is ran. In your case: within your docker container.
If you're using sail, it's probably /var/www/html
and /var/www/html/vendor
- if you are using the settings from the tinker settings page.
Also, "autotoad.php"? How is it not autoload? :P
@Roboroads ok so I changed the settings. Because the interpreter mappings is done in such a way that project root is mapped into the container, I have left the folder settings for the Tinker plugin empty.
Despite having t he settings completelly empty:
Notice the 2 leading slashes...
Thanks! I'm going to take a look at it when I got the time. This indeed does not look right.
This issue has been automatically marked as stale because it has not had recent activity. This means this issue is resolved or nobody else has had this issue or feature request. It will be closed if no further activity occurs within 30 days, so if this is still relevant, please let us know!
Applies Freshness
Is this still an issue with the new PHPStorm updates playing more nice with WSL?
I am sorry I am not using it anymore. I switched to another plugin.
Trying it myself locally with WSL works like intended. Probably, the WSL update of PHPStorm fixed this. If not, I would like to know :)