Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/blackberry/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
我必须在Apache服务器上安装Ruby才能运行脚本吗_Ruby_Apache_Webserver - Fatal编程技术网

我必须在Apache服务器上安装Ruby才能运行脚本吗

我必须在Apache服务器上安装Ruby才能运行脚本吗,ruby,apache,webserver,Ruby,Apache,Webserver,我的笔记本上只有我的脚本。那么,是否有必要在ApacheWebServer上安装ruby来运行它,或者还有其他可能性 非常感谢 您可以直接在笔记本上运行脚本 尝试创建如下示例脚本: echo "puts 'hello'" > example.rb ruby example.rb #!/usr/bin/env ruby puts 'hello' 应打印: hello 您可以通过这种方式运行任何Ruby代码 您还可以使脚本可执行 编辑example.rb,使其如下所示: echo "

我的笔记本上只有我的脚本。那么,是否有必要在ApacheWebServer上安装ruby来运行它,或者还有其他可能性


非常感谢

您可以直接在笔记本上运行脚本

尝试创建如下示例脚本:

echo "puts 'hello'" > example.rb
ruby example.rb
 #!/usr/bin/env ruby
 puts 'hello'
应打印:

hello
您可以通过这种方式运行任何Ruby代码

您还可以使脚本可执行

编辑example.rb,使其如下所示:

echo "puts 'hello'" > example.rb
ruby example.rb
 #!/usr/bin/env ruby
 puts 'hello'
然后在命令行上,使脚本可执行:

 chmod +x example.rb
然后运行它:

 ./example.rb
如果您正在构建更像Rails应用程序的应用程序,并且希望在运行Apache的远程Web服务器上运行它:

  • 在远程Web服务器上,必须安装Ruby。我个人更喜欢比
    rbenv
    rvm
    更好的

  • 安装web应用程序服务器。我个人喜欢Apache

  • 配置Apache。乘客宝石会告诉你怎么做

  • 重新启动Apache


  • 很抱歉我的脚本可以在我的笔记本上使用。我知道如何运行它。我必须在apache Web服务器上运行它,并询问这些可能性。。。没有安装ruby。