title: PHP shell_exec - some shell commands not available
body: <p>before starting - I have seen some SO similar questions, but tbh I got even more lost.</p>
  <p>I am trying to run <code>nvm use</code> and <code>nvm -v</code> within the PHP <code>shell_execute</code>, but am constantly getting the following error:</p>
  <pre><code>sh: nvm: command not found
  </code></pre>
  <p>It seems like PHP is using <strong>Bourne shell</strong> where nvm is not available.
  I am mostly using <strong>Bash</strong> in Terminal where everything is fine (in other shells like ZSH I get the same error).</p>
  <p><strong>Questions:</strong></p>
  <p>How can I make PHP run commands with <code>shell_exec</code> (if there is alternative I am open for considering it) I usually use in Bash?</p>
  <p><strong>Extra notes (maybe helpful):</strong></p>
  <ol>
  <li><p>This command is only used on a local environment so changing settings on dev machine is  something I am open to consider. (would be good to support Mac/Win and Linux, but Mac is the main focus at the moment).</p>
  </li>
  <li><p>If I run <code>which nvm</code> in the <em>bash</em> I get nothing in the terminal.</p>
  </li>
  <li><p>NVM was installed with Brew (don't know if that has any impact)</p>
  </li>
  </ol>
  <p><strong>The usecase:</strong></p>
  <p>I am building a WP CLI toolkit where one of the commands is <code>wp custom install</code>. The command should switch to the right Node.js version of the project, install npm and php dependencies as well as some extra things.</p>
  <pre><code>// basic code sample
  namespace Custom/CustomCli;
  
  class CustomCli {
  
      public static function init(){
      
          if( !(defined('WP_CLI') &amp;&amp; WP_CLI) ) return;
          \WP_CLI::add_command( 'custom', '\Custom\CustomCli' );
  
      }
      
      /*
      * If the Node.js version !== to .nvmrc try 'nvm use'
      * after correct version is selected run 'npm install'
      * also run 'composer install' and 'composer dump-autoload'
      */
      public function install( $args ){
          \WP_CLI::log( shell_exec('nvm -v') ); # once I figure out this I guess I'll know how to fully handle installation
      }
  
  }
  
  CustomCli::init();
  </code></pre>