Hello guys. How could I execute a php script from RoR templates?
I''ve tried to do that in such way:
<% command = ''php /site/script.php uri='' %>
<%= `#{command}` %>
And got this:
X-Powered-By: PHP/4.4.7 Content-type: text/html require
File.dirname(__FILE__) + "/../config/environment" unless defined?
(RAILS_ROOT) # If you''re using RubyGems and mod_ruby, this require
should be changed to an absolute path one, like: # "/usr/local/lib/
ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise
performance is severely impaired require "dispatcher"
ADDITIONAL_LOAD_PATHS.reverse.each { |dir| $:.unshift(dir) if
File.directory?(dir) } if defined?(Apache::RubyRun)
Dispatcher.dispatch
What I''ve done wrong?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
On Aug 2, 2007, at 5:12 AM, spacer wrote:> <% command = ''php /site/script.php uri='' %> > <%= `#{command}` %>trying: <% command = ''hostname'' %> <%= `#{command}` %> ...everything works. i''m guessing you have some path problem -- try explicitly setting the php path, e.g. "/usr/local/bin/pgp /site/ script.php uri=" -faisal --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---