Calling a ruby bin from PHP


#1

Hi,

I’m trying to run jekyll in my user folder (Ruby is installed and configured, jekyll is also installed, both via RVM) from PHP.

While I’m able to run my installation of jekyll with no problems from the shell, I can’t seem to run it using PHP’s exec command. In both cases, the same user is calling jekyll.

I even add just about everything I can to the $PATH via exec, and still no dice:
[php]
exec(’(export PATH=…/…/.rvm/gems/ruby-1.9.3-p194/bin:$PATH; export PATH=…/…/.rvm/bin:$PATH; export PATH=…/…/.rvm/rubies/ruby-1.9.3-p194/bin:$PATH; export GEM_HOME=…/…/.rvm/gems; export GEM_PATH=…/…/.rvm/gems:$GEM_PATH; jekyll) 2>&1’, $output);
[/php]

Each time, I get errors like:
[php]Could not find jekyll (>= 0) amongst [] (Gem::LoadError)[/php]

(Which doesn’t go away when I add the absolute path to the jekyll binary)

I’m certain that all of my paths are correct, and that the same user, with the same permissions, is calling jekyll- and in the shell it works, while with PHP exec, it doesn’t.

Is there some limitation of PHP’s exec that I’m unaware of that’s preventing me from doing this?