I have this Ruby script (test.rb):
print \"hello\"
And I have this PHP script (test.php):
$cmd = \"ruby test.rb\"; system($
Its working for me, check whether both ruby script and php in the same folder and installed ruby in your machine