In one of my Rails application I need to execute a PHP file from the Controller of Ruby on Rails app. The PHP file meant for some database editing.
The php file located in my “public” folder
Is there is any way for doing that?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you want to talk to the process in some way, use
IO.popen("php <script>"). Or you could use the backticks option (not easy with the markup here), which returns the string the process writes to stdout. If you need no communication,system "php <script>"returns you true or false wherever the command succeded and you’ve got no chance to communicate further.If you have unsafe input, use
Array#shelljointo escape it.Why not rewrite the script in ruby?