Home > Software engineering >  Link php interpreter from Docker to bash somehow
Link php interpreter from Docker to bash somehow

Time:03-31

I'm trying to use my docker php as an interpreter in my terminal. What I need:

  • I don't keep my dev envs on my host os. That's important to keep it isolated
  • It should be available as $php or $/usr/bin/env php
  • I'd like to be able to run something like phpcs in my vim. It requires that thingy above.

I've tried this:

alias php='docker-compose exec php php'

But it's not available through /usr/bin/env

CodePudding user response:

/usr/bin/env tries to locate the executable via the $PATH variable, see https://unix.stackexchange.com/a/12749

So if you put your command in to a script called PHP and add it to your $PATH before other PHP executables, it might work.

  • Related