Puphpet Vagrant box | php无法访问rvm gems

Puphpet Vagrant box | php无法访问rvm gems,php,ruby,apache,rvm,vagrant,Php,Ruby,Apache,Rvm,Vagrant,我知道这归结为正确的env值在运行时不适用于php。 作为通过ssh的流浪用户,我可以通过cli运行此脚本并获得所有正确的输出 作为流浪用户,如果我运行evn | grep rvm我会收到大量的条目 我希望php在运行时可以使用这些相同的条目 我尝试以流浪用户的身份运行服务器,但仍然没有得到正确的gem 这是我的测试脚本 // Vagrant x64 Debian Wheezy // Outputs lots of crap echo passthru('ls -al /var/www/webs

我知道这归结为正确的env值在运行时不适用于php。

  • 作为通过ssh的流浪用户,我可以通过cli运行此脚本并获得所有正确的输出
  • 作为流浪用户,如果我运行evn | grep rvm我会收到大量的条目
  • 我希望php在运行时可以使用这些相同的条目
  • 我尝试以流浪用户的身份运行服务器,但仍然没有得到正确的gem 这是我的测试脚本

    // Vagrant x64 Debian Wheezy
    // Outputs lots of crap
    echo passthru('ls -al /var/www/websites/');
    
    // I get nothing with these
    echo passthru('compass');
    echo passthru('/usr/local/bin/compass');
    // the gem actually exists here.
    // But I still get nothing
    echo passthru('/usr/local/rvm/rubies/ruby-1.9.3-p547/bin/compass');
    // Permissions on the file are currently 777 to make sure the is not the problem
    // If I execute "compass" via ssh I get the normal output
    
    // If I add this before the script, my output works
    putenv('PATH=/usr/local/rvm/rubies/ruby-1.9.3-p547/bin:/usr/bin');