简体   繁体   English

使用 EasyPHP 部署 Ruby 应用程序

[英]Deploying Ruby application using EasyPHP

I am new to Ruby and I have dabbled in PHP earlier.我是 Ruby 的新手,我之前已经涉足 PHP。 I have EasyPHP-DevServer-14.1VC9 installed on my Windows 10 PC and I can easily run PHP applications from the server.我的 Windows 10 PC 上安装了 EasyPHP-DevServer-14.1VC9,我可以轻松地从服务器运行 PHP 应用程序。 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几天前我在我的机器上安装了 Ruby with Rails,并将以下代码添加到我的 EasyPHP Apache 服务器的 httpd.conf 文件中

<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.但是,当我启动 EasyPHP 然后转到浏览器并尝试运行包含以下内容的 index.erb 文件时(我正在尝试测试部署)-我只看到字面上的输出,并且没有执行 ruby​​ 代码。 Ruby code gets printed as a string. Ruby 代码被打印为字符串。

Contents of index.erb : 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.就像 PHP 一样,您的 Ruby 代码必须由 Ruby 解释器来解释。 You should add module like Passenger to your Apache installation, if you want to process Ruby with the same Apache installation.如果您想使用相同的 Apache 安装来处理 Ruby,您应该将像Passenger 这样的模块添加到您的Apache 安装中。Google it for detailed documentation on how to do it.谷歌它以获取有关如何执行此操作的详细文档。


UPDATE:更新:

Apparently EasyPHP has Ruby module .显然EasyPHP 有 Ruby 模块 You need to download and install it for Ruby support.您需要下载并安装它以获得 Ruby 支持。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM