Guys you are mixing concepts. Why you can write a php script in a rails app? It no have sense, also if you need to do that always is better to include a line in your controller but this is another history i think.
If you want to do a simple hello world in rails just go to your index.html.erb and write hello world (of course in erb) also you’ll open your localhost (assuming you are working local) just running RoR, so you don’t need apache.