2

I'm using a Vagrant VM created by Puphpet, running Ubuntu 14.04 for the purpose of developing a Wordpress site. I use Composer to manage PHP dependencies, and Composer is installed automatically as a system service via Puphpet, so there is no .phar file, just an executable Composer file in /usr/local/bin/composer.

I also use PHPStorm as my main IDE, and love its Remote Interpreter feature. So far, PHPUnit is the only feature that supports it, as Composer and PHP Codesniffer requires having a local PHP interpreter installed in order to be used. This kind of defeats the purpose of the Composer/PHP Codesniffer tools within PHPStorm when used with Vagrant. Jetbrains claims they have no plans to add this feature in the near future.

Which leads me to my question- Would it be possible to set up a shared folder to the PHP executable file in my VM, and use that as my Remote Interpreter in the Composer Settings window?

Could I also do the same to my PHPCS executable file path in the Code Sniffer settings panel with PHPStorm?

The only one I wouldn't be able to set up a Shared Folder to is the composer.phar file which is needed to run the Composer tool within PHPStorm, because there is no composer.phar file within my VM, as its just an executable in /usr/local/bin/composer as I described earlier. So would the solution be to download a composer.phar file to somewhere within my host directory? Will this interfere the Composer install on the VM?

*Update: As Sven has explained to me, the Composer file in /usr/local/bin/composer is the composer.phar file. I kind of understood this, but still am not sure if a. PHPStorm will recognize it as such, and b. if creating a shared folder will even work.

I added images of the settings panels so you can understand what I'm talking about.

Thanks, let me know if you need anymore info.

enter image description here

enter image description here

P.J.
  • 295
  • 3
  • 13
  • 1
    That `/usr/local/bin/composer` IS the .phar file, just renamed to a more convenient name. – Sven Mar 23 '15 at 20:25
  • Thanks, I assumed that, but I'm still not sure if creating a Shared Folder to it will work in this situation. If someone doesn't answer soon I may have to spin up another VM to try it on. I think it will help a lot of people who are dealing with this across forums. – P.J. Mar 23 '15 at 20:27
  • 1
    I don't know if shared folder is the thing you need, because that will import the filesystem shortcomings of your host machine into your VM, but you'd really want it the other way around. However, I must say that the support for Composer in PHPStorm is lacking, and I do prefer the command line (which uses the PHP of the VM, which hopefully is the same version as in production in your case) - and I wouldn't bother fiddling with shared folders to make PHPCS run, but simply install a PHP version on your guest. – Sven Mar 23 '15 at 20:30
  • Ah, I never realized that. My understand of NFS shared folders is also limited. I just thought I was creating a link to the files, same as if I was to SSH in. – P.J. Mar 23 '15 at 20:32
  • I was specifically meaning Windows host and Linux guests - I assume from your screenshots that you are using MacOS, which is a kind of Linux, but I'm sure has different issues. But probably has a working NFS client to connect the VM to. Windows has not (really - there are some existing, but either paid, or not installable for me...) – Sven Mar 23 '15 at 20:35
  • Yeah, I feel your pain with the Windows NFS system, as I have another computer I deal with it on. I use NFS with a plugin for Vagrant called bindfs, but its not even allowing me to mount the shared folder for /usr/bin/ . I'm not sure if its a permissions issue or if I'm missing something, but Im assuming theres a reason no one has tried this. – P.J. Mar 23 '15 at 20:54

0 Answers0