How would you run a php application from a ruby environment?
Do a search here on meta for “single sign on.”