I am new to Ruby and I have dabbled in PHP earlier. I have EasyPHP-DevServer-14.1VC9 installed on my Windows 10 PC and I can easily run PHP applications from the server. I installed Ruby with Rails on my machine few days ago and added the following code to the httpd.conf file of my EasyPHP Apache server
<IfModule dir_module>
DirectoryIndex index.html index.shtml index.wml index.pwml index.php index.php3 index.php4 index.php5 index.cgi index.rb index.erb
</IfModule>
<virtualHost 127.0.0.1:3001>
ServerName rails
DocumentRoot "C:/Program Files (x86)/EasyPHP-DevServer-14.1VC9/data/localweb/apps"
<Directory "C:/Program Files (x86)/EasyPHP-DevServer-14.1VC9/data/localweb/apps">
Options ExecCGI FollowSymLinks
AllowOverride all
Allow from all
Order allow,deny
AddHandler cgi-script .cgi
AddHandler fastcgi-script .fcgi
</Directory>
</VirtualHost>
But when I start EasyPHP and then go to browser and try to run the index.erb file with following contents (I am trying to test the deployment) - I just see the output literally and the ruby code doesn't get executed. Ruby code gets printed as a string.
Contents of index.erb
:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Expense Management: Home</title>
</head>
<body>
<h1>Welcome to Expense Management</h1>
<td>
<tr>
Let's run some ruby code: <%= 4+5 %>
</tr>
<tr>
Check back later.
</tr>
</td>
</body>
The output I get is this:
Welcome to Expense Management
Let's run some ruby code: <%= 4+5 %> Check back later.
Just like PHP, your Ruby code must be interpreted by Ruby interpreter. You should add module like Passenger to your Apache installation, if you want to process Ruby with the same Apache installation. Google it for detailed documentation on how to do it.
UPDATE:
Apparently EasyPHP has Ruby module. You need to download and install it for Ruby support.