Linux主机的语言
出自美国主机知识库
对
Linux主机的语言
的源代码
跳转到:
导航
,
搜索
根据以下的原因,您无权限进行编辑这个页面操作:
您刚才请求的操作只有这个用户组中的用户才能使用:
用户
您可以查看并复制此页面的源代码:
Linux Programming =PHP= General PHP Information Articles ==能用没有扩展名的PHP文档吗?== 安全关系,我们把PHP当作CGI而不是模块来运行。鉴于此,再加上我们运行的Apache版本是1.3.3,若没 有使用像mod_rewrite那样的工具的话,你不能在你的网站上用没有扩展名的PHP文档。 获得更多信息,见[http://help.godaddy.com/article/898What is mod_rewrite?] ==你们支持PHP-Nuke吗== 我们的所有Linux 托管帐户都支持使用PHP-Nuke. 请查看在线的PHP可用的论坛,以获得具体产品的帮助,包括安装及配置说明。 Windows托管帐户暂时还不支持使用PHP-Nuke. [http://www.phpmyadmin.net/ www.phpmyadmin.net] [http://www.nukecops.com/ www.nukecops.com] [http://www.karakas-online.de/forum/viewforum.php?f=1 PHP-Nuke Forum] ==Linux主机是以安全模式运行PHP的吗? 不是的,我们在Linux托管服务器上不是以安全模式运行PHP的。 获得更多有关安全模式的信息的话,请访问[http://www.php.net/ www.php.net] ==遇到PHP header错误信息的时我该怎么办?== <pre>错误信息: Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /home/content/u/s/e/username/html/file.php:2) in /home/content/u/s/e/username/html/file.php on line 3 Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/content/u/s/e/username/html/file.php:2) in /home/content/u/s/e/username/html/file.php on line 3 Warning: Cannot modify header information - headers already sent by (output started at /home/content/u/s/e/username/html/file.php:2) in /home/content/u/s/e/username/html/file.php on line 4 原因: This error is caused if the your PHP scripts are printing to the browser prior to sending headers. A common example is printing the html tags prior to starting a session, or setting a cookie. The error tells the line that needs to be altered (in this case, it is on /file.php line 2). 解决方案: To resolve this error remove the lines from the PHP code that are printing to the browser prior to sending headers.</pre> ==多长时间清空Linux虚拟主机上的临时文件夹== Linux托管服务器上的所有临时文件目录若在720小时(30天)内都没有什么访问的话将被清除。 ==Linux主机支持Non-parsed Headers吗?== 不。我们的托管计划不支持non-parsed headers (NPH)/未解析的栏头. 如果你的旧的CGI脚本是打算在apache/1.2上运行,或者是NPH脚本,那么去除任何能显示处HTTP header的代码 ,如 HTTP/1.1 200 OK, 你的脚本就会正常了。 ==你们支持fsockopen吗?== 是的,我们支持。你可以在所有启用PHP的托管计划上使用fsockopen. ==你们的Linux主机是否禁用PHP功能?== PHP 4 我们在我们的Linux 托管帐户上没有禁用任何PHP 4功能。 PHP 5 默认状态下, PHP 5 function register_globals被关闭。 要更改功能状态的话,你可以使用custom initialization files. 获得更多信息,见[http://help.godaddy.com/article/1085 How do I add a PHP initialization file to my hosting account?] ==申请新的PHP模块?== 我们努力让我们的托管客户能够即是用到最流行的模块。要请求使用某个我们目前没有的模块的话,请联系技术支持。虽然我们不能立刻安装每个请求的模块,我们会记录 下所有模块请求,并根据具体请求的普遍程度使它们称为默认模块。 ==给linux主机添加PHP初始化文档?== 如果你运行的是Hosting Configuration 2.0, 你可以在你的站点的根目录为PHP 4 (php.ini)及PHP 5 (php5.ini)创建custom .ini文档。初始化文档可以 用来管理form, 服务器,及环境变量,服务器端cookies, 临时目录,错误显示及错误登陆。 注: php.ini及php5.ini 文档只有在根目录才能适当工作。这些文档若是放到子目录里的话,将无法工作,不管它们是否aliased to the root directory. ==更改PHP语言版本== 注: 此内容仅适用于运行Hosting Configuration 2.0的Linux主机帐户。 PHP会自动添加到你的托管帐户上去。但是,你可以选择你想用的版本。 更改默认的PHP语言 1. 登陆你的Account Manager. 2. 在My Products 部分选择Hosting Account List. 3. 点击你想更改的托管帐户旁边的Open. 4. 在Hosting Control Center 的Content 部分点击Languages 图标。 5. 选择你想设置为默认状态的 PHP版本。 6. 点击Continue. 7. 核实列出的更改,然后点击Update. 你的语言更改即被提交。请等待24小时,以便让托管服务器处理你的更改。 注:虽然PHP5是最新版本,许多应用程序还是需要版本4.因此,此更新可能会导致你的某些PHP文档不能正常运行. ==使用PHP连接到Linux主机== 帐户上的某个MySQL数据库 这个示例描述的是使用PHP连接到某个Linux托管帐户上的一个 MySQL数据库。 <pre><?php //Sample Database Connection Syntax for PHP and MySQL. //Connect To Database $hostname="mysql.secureserver.net"; $username="your_dbusername"; $password="your_dbpassword"; $dbname="your_dbusername"; $usertable="your_tablename"; $yourfield = "your_field"; $connection = mysql_connect("$hostname", "$username", "$password"); mysql_select_db("$databasename", $con); # Check If Record Exists $query = "SELECT * FROM $usertable"; $result = mysql_query($query); if($result) { while($row = mysql_fetch_array($result)) { $name = $row["$yourfield"]; echo "Name: ".$name." "; } } ?> </pre> ==Linux主机PHP上传限制是多少?== <pre>除非你的可用的磁盘空间不够外,我们没有设置什么FTP上载限制。但是,默认状态下,PHP把上载的文档限制在 8 MB. 要更改这一参数,在/php.ini 文档里编辑如下参数: memory_limit = 50M post_max_size = 8M file_uploads = On upload_max_filesize = 15M 上述设置更改你的PHP上载限制,允许你上载大小为8MB的文档。但是,你可以把PHP上载限制增加到超过15MB</pre> =PHP 5 = ==哪些PHP文件可以与主机一起使用?== 运行Hosting Configuration 2.0的Linux托管帐户支持PHP 4和PHP 5.根据你的htaccess文档的内容,可以使用 如下PHP文档扩展名: .php, .php4, 及 .php5. 获得使用没有扩展名的PHP文档的信息,见[http://help.godaddy.com/article/1274 Can I use extensionless PHP files?] 获得更多有关所支持的语言的信息,见[http://help.godaddy.com/article/26 Which programming languages do you support with CGI?] ==把server variable ($_SERVER)与PHP5一起应用== 我们的Linux主机在CGI模式下运行。当PHP5在这一模式下运行时,server variable PATH_INFO 的行为与在PHP4下面有所不同。 PHP5脚本可在PATH_INFO 位置使用SCRIPT_NAME 元素,以确保能返回期望值。 ==PHP4 domxml模块能与PHP5一起使用吗== 在PHP5里不支持PHP 4 domxml模块,它已被dom模块取代。移动到PHP5时,任何使用domxml模块功能的脚本必须要更改成使用dom模块功能的。 [http://help.godaddy.com/article/1083?prog_id=GoDaddy& Can I run both PHP 4 and PHP 5 applications on my hosting account?] 能在我的托管帐户上同时运行PHP4及PHP5应用程序吗? 可以的。如果你的站点运行的是Hosting Configuration 2.0,那么PHP4及PHP5都可在你的站点运行。默认状态 下,PHP 5文档需要.php5扩展名,而.php扩展名将在PHP4下面运行。你可以通过htaccess文档来更改这些设置。 见How do I use htaccess to manage file extensions?以获得更多信息。 如果你的站点没有运行新的托管配置,而你想进行升级的话,见How do I upgrade my hosting account to Hosting Configuration 2.0?. 注: 对已有htaccess 文档做的更改立刻即可看到。但如果是创建新的htaccess 文档或者删除某个已有htaccess 文档,这些更改知道htaccess 缓存清除后才能看到。htaccess 缓存每小时进行一次清楚。 ==更改PHP版本== <pre>注: 此内容仅适用于运行Hosting Configuration 2.0的Linux虚拟主机 PHP会自动添加到主机上。但是,你可以选择版本。 更改默认的PHP语言 1、 登陆你的Account Manager. 2、 在My Products 部分选择Hosting Account List. 3、 点击你想更改的托管帐户旁边的Open. 4、 在Hosting Control Center 的Content 部分点击Languages 图标。 5、 选择你想设置为默认状态的 PHP版本。 6、 点击Continue. 7、 核实列出的更改,然后点击Update. 你的语言更改即被提交。请等待24小时,以便让托管服务器处理你的更改。 注:虽然PHP5是最新版本,许多应用程序还是需要版本4.因此,此更新可能会导致你的某些PHP文档不能正常运行</pre> ==Linux主机能用哪种版本的PHP?== 我们的Linux托管帐户运行的PHP版本是5.2.5及4.3.11. 获得有关PHP 5.2.5的信息,见PHP 5.2.5 Release Announcement. 获得有关运行PHP 4及PHP 5应用程序的信息,见[http://help.godaddy.com/article/1083?prog_id=GoDaddy& Can I run both PHP 4 and PHP 5 applications on my hosting account?] 要更改你的PHP版本的话,见[http://help.godaddy.com/article/3937?prog_id=GoDaddy& Changing Your PHP Language Version] =PHP Form Mailer= ==为PHP Form-Mailer指定一个电子邮件地址== <pre>要使用我们的PHP form-mailer, 你必须要指定一个你想让你的所有的form发送到的电子邮件地址。 为Form-Mailer指定电子邮件地址 1. 登陆你的Account Manager. 2. 在My Products 部分选择Hosting Account List. 3. 在你想更改的托管帐户旁边点击Open. 4. 在Hosting Control Center 的Content 部分点击Form Mail 图标。 5. 在Forms Email Address 部分输入你的form-mailer想用的电子邮件地址。 6. 点击 Continue. 7. 核实这就是你为你的form-mailer用的电子邮件地址,并点击Update</pre> ==使用PHP Form-Mailer== 要使用PHP form-mailer, 在HTML里创建个连接到位于你的托管帐户的根目录的PHP脚本的Web form,然后把它上传到主机。 记得在你的account manager里指定你想为这个form-mailer使用的电子邮件地址。获得更多信息,见[http://help.godaddy.com/topic/77/article/508 Specifying an Email Address for the PHP Form-Mailer] ==使用PHP Form-Mailer== <pre>1.像往常一样创建你的Web form,并给form里的条目分配独一无二的名字。 注: 记住,我们的form-mailer在撰写电子邮件讯息时会按照字母顺序整理你的form条目名。先后顺序是:大写,字母,小写字母,数字。 2.至于form action line, 输入/gdform.php.例如: <form action="/gdform.php" method="post"> 3.把form method 设置为"post." 4.除了你在你的form里创建的空白区域外,还有三个你要使用的特殊区域:主题, redirect, and email. 主题. 控制的是form mail里的主题行。 Redirect.控制的是访问者提交form 后将看到的页面。 Email. 控制的是form email的回复地址。 例如: <form action="/gdform.php" method="post"> <input type="hidden" name="subject" value="Form Submission" /> <input type="hidden" name="redirect" value="thankyou.html" /> <p>First Name:<input type="text" name="FirstName" /></p> <p>Last Name:<input type="text" name="LastName" /></p> <p>E-Mail:<input type="text" name="email" /></p> <p>Comments:<textarea name="comments" cols="40" rows="10"> Type comments here.</textarea></p> <input type="submit" name="submit" value="submit"/> </form> 5.保存并把form上传到主机。 获得重新安装你的默认脚本的信息的话,见</pre>[http://help.godaddy.com/article/3434 How Do I Reinstall the Default Scripts Directory?] ==在PHP代码里应该用什么电子邮件或者relay服务器?== 如果你在PHP里使用mail() 功能,你不需要指定一个往外发送电子邮件的服务器。如果你用的是除mail()之外的 其他方法,你的relay服务器要使用relay-hosting.secureserver.net. =open_basedir= ==什么是open_basedir?== open_basedir功能定义了PHP可以从哪些路径或者位置使用fopen()及gzopen()功能查看文档。如果某文档在 open_basdir定义的路径之外,PHP将拒绝打开它。 你不能用某个象征性的链 接作为工作区,这是因为该象征性链接解析到的路径在open_basedir 功能的限制下失败了。 注: open_basedir限制可以在Apache配置文档httpd.conf里用下面这行代码关闭: php_admin_value open_basedir none ==Linux共享主机能用open_basedir吗?== 对共享Linux托管帐户来说,默认的open_basedir 限制没有什么参数。PHP脚本可以访问你的托管帐户里的所有目录。 =Zend= ==使用Zend Optimizer™== <pre>Zend Optimizer™是一款运行并优化Zend Guard编码的文件的免费应用程序,它可以增强PHP应用程序的性能。 Zend Optimizer安装在所有PHP4的Linux共享托管账户里。客户可以上传新的版本的Zend Optimizer(及其他PHP模块),并参照他们的文档给出路径。 敬告: 在PHP5下无效。如果你试图在PHP5里使用安装版的Zend Optimizer ,它将带来一些麻烦问题。 如果你想使用你自己的php.ini及Zend Optimizer, 添加如下(代码)至你的php.ini: [Zend] zend_optimizer.optimization_level=15 zend_extension_manager.optimizer=/usr/local/Zend/lib/Optimizer-2.5.7 zend_extension_manager.optimizer_ts=/usr/local/Zend/lib/Optimizer_TS-2.5.7 zend_extension=/usr/local/Zend/lib/ZendExtensionManager.so zend_extension_ts=/usr/local/Zend/lib/ZendExtensionManager_TS.so</pre> == Linux Economy Hosting Plan是否安装了Zend Optimizer 及GD Library== <pre>是的。所有Linux共享托管账户都安装了适用于PHP4的Zend Optimizer™及GD Library. GD Library 是一个a PHP library。它影响着图片大小调整,及其他东西。 Zend Optimizer™ 与Zend Guard™ 一道来加强PHP应用程序的性能。Zend Guard通过在分配应用程序时不揭露 它们的源代码的方式来保护PHP应用程序的源代码。Zend Optimizer运行并优化Zend Guard编码的文档,这样可以加强PHP应用程序的性能。 客户可以上传新的版本的Zend Optimizer(及其他PHP模块),并参照他们的文档给出路径。 敬告: 在PHP5下无效。如果你试图在PHP5里使用安装版的Zend Optimizer ,它将带来一些麻烦问题。 如果你想使用你自己的php.ini及Zend Optimizer, 添加如下(代码)至你的php.ini: [Zend] zend_optimizer.optimization_level=15 zend_extension_manager.optimizer=/usr/local/Zend/lib/Optimizer-2.5.7 zend_extension_manager.optimizer_ts=/usr/local/Zend/lib/Optimizer_TS-2.5.7 zend_extension=/usr/local/Zend/lib/ZendExtensionManager.so zend_extension_ts=/usr/local/Zend/lib/ZendExtensionManager_TS.so</pre> =cURL= ==为何要使用CURL?== 你可以使用CURL从一个远程系统获得信息,并把该信息用到你的网站上去 例如,你可以使用CURL连接到一个带有RSS feed的站点,或者连接到authorize.net's HTTPS payment processing gateway. ==你们支持使用CURL吗?== <pre>是的。我们的所有Linux主机支持使用所有CURL扩展名。 CURL代表Client URL Library. 在你的PHP代码里,你可以使用CURL连接到并与许多带有多种不同协议的不同服务器进行交流。你可以使用CURL从你的托管帐户连 接到某个HTTP或者HTTPS站点。 例如,你可以使用CURL连接到一个带有RSS feed的站点,或者连接到authorize.net's HTTPS payment processing gateway. Using CURL to Connect Using HTTPS <pre>下面的PHP脚本使用CURL安全连接到一个远程系统 (http://www.paypal.com), 从该系统获取数据,然后以那数据创建个网页。 注: 在我们的共享托管账户里,任何进行安全HTTP连接的CURL应用程序都需要通过一个proxy server. 这个 proxy server的网址是proxy.shr.secureserver.net,且连接必须要指定使用的是3128端口。下面代码已经包括这一信息。 <? $URL="https://www.paypal.com"; if (isset($_GET["site"])) { $URL = $_GET["site"]; } $ch = curl_init(); echo "URL = $URL <br>n"; curl_setopt($ch, CURLOPT_VERBOSE, 1); curl_setopt ($ch, CURLOPT_HTTPPROXYTUNNEL, TRUE); curl_setopt ($ch, CURLOPT_PROXYTYPE, CURLPROXY_HTTP); curl_setopt ($ch, CURLOPT_PROXY,"http://proxy.shr.secureserver.net:3128"); curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt ($ch, CURLOPT_URL, $URL); curl_setopt ($ch, CURLOPT_TIMEOUT, 120); $result = curl_exec ($ch); echo "<hr><br>n"; echo 'Errors: ' . curl_errno($ch) . ' ' . curl_error($ch) . '<br><br>'; echo "<hr><br>n"; curl_close ($ch); print "result - $result"; echo "<hr><br>n"; ?></pre> =Ruby= Ruby on Rails Troubleshooting/ Ruby on Rails问题解决 执行Ruby on Rails 时可能遇到一些常见问题。下面列表里给出的就是人们初始创建Rails应用程序时可能遇到的问题。 :Contents/内容 :[http://help.godaddy.com/topic/321/article/1406#location Location]/ 位置 :[http://help.godaddy.com/topic/321/article/1406#endings Line endings]/命令行结尾 :[http://help.godaddy.com/topic/321/article/1406#logs Error logs]/错误日志 :[http://help.godaddy.com/topic/321/article/1406#log Production log]/产品日志 :[http://help.godaddy.com/topic/321/article/1406#errorsSample errors]/示例错误 :[http://help.godaddy.com/topic/321/article/1406#mode Development mode]/开发模式 :[http://help.godaddy.com/topic/321/article/1406#performance Performance]/性能 :[http://help.godaddy.com/topic/321/article/1406#version Rails version/Rails]版本 :[http://help.godaddy.com/topic/321/article/1406#database Database connectivity]/数据库连接性 :[http://help.godaddy.com/topic/321/article/1406#conflict Language conflict]/语言冲突 :[http://help.godaddy.com/topic/321/article/1406#links Symbolic links]/符号链接 <pre>Location/位置 Rails应用程序的CGI文档的第一行必须要正确参照Ruby位置。下面展示的即是一个例子,这里"/usr/local/ruby/"即是Ruby所在的位置的目录: #!/usr/bin/env ruby 如果你是本地建站,确保上传前在你的CGI文档里更改Ruby目录。 Line endings/行尾 要想shell正确决定编译器的话,上载到你的Linux共享托管帐户的脚本文档需要Unix 行尾. 获得更多信息,见 [http://help.godaddy.com/article/1275 Can I use DOS line endings with my Linux hosting account?] Error logs/错误日志 启用错误日志能够警示你一些可能被误认为Ruby错误的CGI方面的错误。这些错误在Rails被调用前就会发生。参考下面文章获得更多信息: [http://help.godaddy.com/article/1197 How do I enable CGI error collection?] [http://help.godaddy.com/article/1198 How do I view my CGI error logs?] Production log/产品日志 生产日志能提供问题解决信息。每个Rails应用程序都由一个产品日志。它位于你的应用程序的log目录里。 Sample errors/示例错误 下面是你可能遇到的一个典型错误: ActionController::RoutingError (Recognition failed for "/tags/lst/"): /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.11.2/ lib/action_controller/routing.rb:469:in `recognition_failed' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.11.2/ lib/action_controller/routing.rb:459:in `recognize!' /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.5/lib/ dispatcher.rb:38:in `dispatch' /home/content/j/h/l/jhlinux/html/cloud/dispatch.cgi:10 此错误传达的信息是Rails没法在"cloud" rails 应用程序里找到第一调度器/"lst" dispatcher. Development mode/开发模式 在开发模式里运行你的应用程序将产生一个大型的日志文档,但很少能用它来定位错误区域。要更改你的环境的 话,更改你的R environment.rb文档,这样RAILS_ENV变量就被设置成"development"参数。获得更多信息,见</pre> [http://help.godaddy.com/article/1095 How do I ensure production performance under Hosting Configuration 2.0?] <pre>Performance/性能 如果你的Rails应用程序运行速度慢,你可通过在你的Rails应用程序的"public"目录的.htaccess 文档做出如下更改以启用FastCGI: Change RewriteRule ^(.*)$ dispatch.cgi [QSA,L] to RewriteRule ^(.*)$ dispatch.fcgi [QSA,L] Rails version/Rails版本 目前支持的是Rails 1.1.6版本。也有可能由于你在你的environment.rb 文档中指定了不兼容的版本而禅城兼容性错误。这个条目将类似下面的内容: RAILS_GEM_VERSION = 'x.x.x' 冻结Rails gems可确保应用程序兼容性,但使用先前的Rails版本的话可能会让你的数据遇到风险。获得更多信息,</pre>见[http://help.godaddy.com/article/1090 What does it mean to freeze Ruby Gems?] <pre>Database connectivity/数据互联性 你的database.yml文档应该与下面相似: production: adapter: mysql database: [your database name] username: [your mysql login] password: [your mysql password] host: [your mysql server name (not "localhost")] port: 3306 Language conflict/语言冲突 如果你的托管帐户启用了Java,它将与Rails有所冲突。 Symbolic links/符号连接 你在应用程序的public 目录里创建的符号连接即是应用程序所在的位置。例如 http://www.coolexample.com/ruby_appliation/ 要创建一个cleaner URL的话,利用指向该链接的域名别名或者子域名。这么做的时候,在你的应用程序的 public/.htaccess文档里设置"RewriteBase /". 创建个域名别名或者子域名不会覆盖你的已有内容。获得更多信息,见下面文章:</pre> [http://help.godaddy.com/article/46 Adding a domain alias to your hosting account] [http://help.godaddy.com/article/297 Adding a sub domain to your hosting account] ==什么是Ruby on Rails?== Ruby on Rails是为创建数据库Web应用程序而在Ruby脚本语言里建立的开放源码的Web框架。运行Hosting Configuration 2.0的Deluxe及Premium 主机支持Ruby on Rails及其应用程序。启用Java的托管帐户不支持Ruby on Rails. ==新的Ruby Gems== <pre>下面使我们的共享托管帐户新添加的Ruby Gems: • PDF-Writer: 使用Ruby来创建PDF文档的一个Gem. http://ruby-pdf.rubyforge.org/pdf-writer/ • Ferret: 基于Apache Lucene项目的Ruby搜索引擎 http://ferret.davebalmain.com/trac/ • RFlicker: A Ruby interface to Flickr's developer API. http://rubyforge.org/projects/rflickr/ • RMagick: A Ruby interface to the ImageMagick library. http://www.simplesystems.org/RMagick/doc/index.html • Rails 1.1.2: 常请求的Ruby on Rails升级。 见 Integrating existing Ruby applications with Rails version 1.1.2 来获得更多信息。 我们努力让我们的托管客户能及时用到最常用的Gems。要请求某个我们目前还没有提供的gem, 请联系技术支持</pre> ==什么是Ruby Gems?== <pre>Gems之于Ruby的功能如同PHP脚本库一样。它们为编程提供内置功能。运行Hosting Configuration 2.0的Deluxe 及Premium主机帐户已经选择安装了一些实时更新的Gems版本。要想知道你的托管帐户上安装了什么Gems的话, 见</pre>What Ruby Gems are installed on my hosting account? ==上传Ruby脚本== 要Ruby脚本 (文档扩展名为.rb) 起作用的话,它必须是可执行文档,且以ASCII (Linux)格式(FTP)上传。 ==freezeRuby Gems是什么意思?== 注: 此文仅适用于运行Hosting Configuration 2.0的Deluxe及Premium托管帐户。启用Java的托管帐户不支持使用Ruby on Rails. 冻结Ruby Gems阻止你的Ruby on Rails在任何主机上出现任何新的版本时自动更新它的Gems. 这样你就能控制你的主机帐户运行的Gems版本。 下面在你的dev环境下运行的命令把当前的系统Gems解压到vendor/rails目录: rake freeze_gems 此法运行后,你的应用程序将不会再受主机Gem更新影响。 ==在Hosting Configuration 2.0?下如何确保production performance== 注: 此文仅适用于运行Hosting Configuration 2.0的Deluxe及Premium托管帐户。启用Java的托管帐户不支持使用Ruby on Rails. SetENV是一种指定你的Ruby on Rails应用程序运行环境(开发,测试,或者production)功能。默认状态下, 你的应用程序配置成在production环境下运行。我们是考虑到性能有点及minimal logging才推荐这一模式的. 要覆盖这一设置并在开发或者测试模式下运行你的应用程序的话,把如下代码添加到你的应用程序的 config/environment.rb文档,用参数"development"或者 "test"来替代"[environment]": RAILS_ENV = "[environment]" ==从哪里找到更多有关Ruby on Rails的信息?== 有很多Ruby on Rails资源的网站。下面列出了一些: http://www.rubyonrails.org/ http://www.onlamp.com/pub/a/onlamp/2005/01/20/rails.html http://wiki.rubyonrails.com/rails/pages/Tutorial ==指定Gem版本== 在你的config/environment.rb 文档里使用require_gem命令来指定你的应用程序想加载的Gem版本。以Gem "actionpack"为例,它的句法显示如下: require_gem 'actionpack', '= 1.11.2' 要制定一系列版本的话,使用如下句法: require_gem 'actionpack', '~> 1.11' 如果省略了版本号的话,加载的将是最新版本。 ==如何申请新的Gems? 我们努力让客户能及时用到最常用的Gems。要请求某个我们目前还没有提供的gems, 请联系技术支持 ==如何在Rails程序创建Ruby?== 注: 此文仅适用于运行Hosting Configuration 2.0的Deluxe及Premium类型的主机。启用Java的托管帐户不支持使用Ruby on Rails. 安装一个Ruby on Rails应用程序 1. 登陆你的Account Manager. 2. 在My Products 部分选择Hosting Account List. 3. 在你想更改的托管帐户旁边点击Open. 4. 在Hosting Control Center 的Content 部分点击CGI Admin 图标。 5. 点击Ruby键. 6. 在Create Rails App Directory 面板的文本框内,输入你的应用程序将停放的目录,然后点击Create. 7. 上载(FTP) 你的应用程序至新创建的目录。 ==如何为Ruby on Rails应用程序创建友好的URL?== 注: 此文仅适用于运行Hosting Configuration 2.0的Deluxe及Premium主机帐户。启用Java的托管帐户不支持使用Ruby on Rails. 当你的Rails应用程序已经上载(FTP)到你的托管账户,你可以创建一个用户友好的符号链接连接到它。 创建个到Rails应用程序的符号连接 1. 登陆你的Account Manager. 2. 在My Products 部分选择Hosting Account List. 3. 在你想更改的托管帐户旁边点击Open 4. 在Hosting Control Center 的Content 部分点击CGI Admin 图标。 5. 点击Ruby 键。 6. 在Create Rails Symbolic Link 面板里,从下拉列表里选择合适的应用程序。 7. 在文本框内,输入URL. 8. 点击Create. ==虚拟主机上安装了什么Ruby Gems?== 注: 此文仅适用于运行Hosting Configuration 2.0的Deluxe及Premium托管帐户。启用Java的托管帐户不支持使用Ruby on Rails 查看主机上安装了什么Ruby Gems 1. 登陆你的Account Manager. 2. 在My Products 部分选择Hosting Account List. 3. 在你想更改的托管帐户旁边点击Open 4. 在Hosting Control Center 的Content 部分点击CGI Admin 图标。 5. 点击Ruby 键。 6. 在Ruby Gems 面板里点击Display. ==安装了的Ruby Gems== 注: 这个安装到运行Hosting Configuration 2.0的Deluxe及Premium共享托管账户里的Ruby Gems列表定期更新,但可能无法显示出最新更新。 要找出最新的Gems列表,见What Ruby Gems are installed on my hosting account?. Ruby Gems有两个存在路径:一个安装了成熟版本的标准路径,及一个安装了新版本的开发路径。要访问在开发路径里的Gems的话,把如下这行代码添加到你的 应用程序的config/environment.rb 文档里。这个代码必须要在 the call to Rails::Initializer之前出现. ENV['GEM_HOME'] = '/usr/local/lib/ruby/gems-dev/1.8' 这个位置也是将来的Rails版本要存在的位置。要确保已有应用程序与将来的Gem版本的兼容性的话,你可以冻结 Gems或者使用Ruby的require_gem命令来指定Gem版本。 获得更多有关冻结Gems的信息,见[http://help.godaddy.com/article/1090 What does it mean to freeze Ruby Gems?] 获得更多有关require_gem的信息,见[http://help.godaddy.com/article/1378 Specifying Gem versions] <pre>Installed Ruby Gems (standard path)/安装了的Ruby Gems (标准路径) actionmailer 1.2.4 [www] - depends on [http://help.godaddy.com/topic/321/article/1373#actionpack actionpack]. Service layer for easy email delivery and testing. actionpack 1.12.4 [www] - depends on [http://help.godaddy.com/topic/321/article/1373#activesupport activesupport]. Web-flow and rendering framework putting the VC in MVC. actionwebservice 1.1.5 [www] - depends on actionpack, activerecord. Web service support for Action Pack. activerecord 1.14.4 [www] - depends on activesupport. Implements the ActiveRecord pattern for ORM. activesupport 1.3.1 [www] Support and utility classes used by the Rails framework. ajax_scaffold_generator 3.1.2 [www] Ajax scaffold generator is a rails generator for ajaxified scaffolds archive-tar-minitar 0.5.1 [www] Provides POSIX tarchive management from Ruby programs. Executable is minitar. Bloglines4R 0.1.0 [www] A library to access the Bloglines API from Ruby BlueCloth 1.0.0 [www] BlueCloth is a Ruby implementation of Markdown, a text-to-HTML conversion tool for web writers. Markdown allows you to write using an easy-to-read, easy-to-write plain text format, then convert it to structurally valid XHTML (or HTML). builder 2.0.0 [www] Builders for MarkUp. cmdparse 2.0.2 [www] Advanced command line parser supporting commands color-tools 1.3.0 [www] color-tools provides colour space definition and manpiulation as well as commonly named RGB colours. diff-lcs 1.1.2 [www] Provides a list of changes that represent the difference between two sequenced collections. Executables are htmldiff, ldiff. EliteJournal 1.9.492 [www] - depends on RedCloth, sqlite-ruby. Easy to install, multi-user blog software Executable is elitejournal. fcgi 0.8.6.1 [www] FastCGI ruby binding. ferret 0.9.3 [www] Ruby indexing library. gnuplot 2.2 [www] Utility library to aid in interacting with gnuplot htmltools 1.09 [www] This is a Ruby library for building trees representing HTML structure. instiki 0.10.2 [www] - depends on madeleine, rails, RedCloth, rubyzip. Easy to install WikiClone running on WEBrick and Madeleine Executable is instiki. login_generator 1.2.0 [www] - depends on rails. [Rails] Login generator. madeleine 0.7.3 [www] Madeleine is a Ruby implementation of Object Prevalence mime-types 1.15 [www] Manages a MIME Content-Type that will return the Content-Type for a given filename. mysql 2.7 [www] MySQL/Ruby provides the same functions for Ruby programs that the MySQL C API provides for C programs. PageTemplate 2.2.0 [www] A simple templating system for Web sites. ParseTree 1.3.7 [www] - depends on RubyInline. Extract and enumerate ruby parse trees. Executables are parse_tree_abc, parse_tree_deps, parse_tree_show. ParseTree 1.4.1 [www] - depends on RubyInline. Extract and enumerate ruby parse trees. Executables are parse_tree_abc, parse_tree_deps, parse_tree_show. payment 1.0.1 [www] Payment is used to process credit cards and electronic cash through merchant accounts. pdf-writer 1.1.3 [www] - depends on color-tools, transaction-simple. A pure Ruby PDF document creation library. Executable is techbook. podcast 0.0.4 [www] Create podcasts from MP3 files Executable is podcast. rails 1.1.5 [www] - depends on actionmailer, actionpack, actionwebservice, activerecord, activesupport, rake. Web-application framework with template engine, control-flow layer, and ORM. Executable is rails. rake 0.7.1 [www] Ruby based make-like utility. Executable is rake. RedCloth 3.0.4 [www] RedCloth is a module for using Textile and Markdown in Ruby. Textile and Markdown are text formats. A very simple text format. Another stab at making readable text that can be converted to HTML. Executable is redcloth. rflickr 2006.02.01 [www] - depends on mime-types. Ruby interface to the Flickr API rmagick 1.12.0 [www] RMagick is an interface between the Ruby programming language and the ImageMagick and GraphicsMagick image processing libraries. RubyInline 3.5.0 [www] Multi-language extension coding within ruby. Executable is inline_package. rubyslippers 1.03 [www] RubySlippers is a GUI wrapper for RubyGems using RubyWebDialogs. Executable is rubyslippers. rubyzip 0.5.12 [www] rubyzip is a ruby module for reading and writing zip files rubyzip 0.5.8 [www] rubyzip is a ruby module for reading and writing zip files ruwiki 0.9.3 [www] - depends on archive-tar-minitar, diff-lcs. A simple, extensible, and fast Wiki-clone. Executables are ruwiki, ruwiki.cgi, ruwiki_convert, ruwiki_service.rb, ruwiki_servlet. shipping 1.3.0 [www] - depends on builder. A general shipping module to find out the shipping prices via UPS or FedEx. shorturl 0.8.3 [www] Shortens URLs using services such as TinyURL and RubyURL Executable is shorturl. sqlite-ruby 2.2.3 [www] SQLite/Ruby is a module to allow Ruby scripts to interface with a SQLite database. syntax 1.0.0 [www] Syntax is Ruby library for performing simple syntax highlighting. Technorati-Ruby 0.1.0 [www] Technorati(http://technorati.com/) bindings for Ruby. tidy 1.1.2 [www] Ruby interface to HTML Tidy Library Project transaction-simple 1.3.0 [www] Simple object transaction support for Ruby. webgen 0.3.8 [www] - depends on cmdparse. Webgen is a templated based static website generator. Executable is webgen. wee 0.10.0 [www] Wee is a framework for building highly dynamic web applications. Executable is wee. xml-simple 1.0.8 [www] A very simple API for XML processing. Installed Ruby Gems (development path) actionmailer 1.2.4 [www] - depends on actionpack. Service layer for easy email delivery and testing. actionpack 1.12.4 [www] - depends on activesupport. Web-flow and rendering framework putting the VC in MVC. actionwebservice 1.1.5 [www] - depends on actionpack, activerecord. Web service support for Action Pack. activerecord 1.14.4 [www] - depends on activesupport. Implements the ActiveRecord pattern for ORM. activesupport 1.3.1 [www] Support and utility classes used by the Rails framework. ajax_scaffold_generator 3.1.2 [www] Ajax scaffold generator is a rails generator for ajaxified scaffolds archive-tar-minitar 0.5.1 [www] Provides POSIX tarchive management from Ruby programs. Executable is minitar. Bloglines4R 0.1.0 [www] A library to access the Bloglines API from Ruby BlueCloth 1.0.0 [www] BlueCloth is a Ruby implementation of Markdown, a text-to-HTML conversion tool for web writers. Markdown allows you to write using an easy-to-read, easy-to-write plain text format, then convert it to structurally valid XHTML (or HTML). builder 2.0.0 [www] Builders for MarkUp. cmdparse 2.0.2 [www] Advanced command line parser supporting commands color-tools 1.3.0 [www] color-tools provides colour space definition and manpiulation as well as commonly named RGB colours. diff-lcs 1.1.2 [www] Provides a list of changes that represent the difference between two sequenced collections. Executables are htmldiff, ldiff. EliteJournal 1.9.492 [www] - depends on RedCloth, sqlite-ruby. Easy to install, multi-user blog software Executable is elitejournal. fcgi 0.8.6.1 [www] FastCGI ruby binding. ferret 0.9.3 [www] Ruby indexing library. gnuplot 2.2 [www] Utility library to aid in interacting with gnuplot htmltools 1.09 [www] This is a Ruby library for building trees representing HTML structure. instiki 0.10.2 [www] - depends on madeleine, rails, RedCloth, rubyzip. Easy to install WikiClone running on WEBrick and Madeleine Executable is instiki. login_generator 1.2.0 [www] - depends on rails. [Rails] Login generator. madeleine 0.7.3 [www] Madeleine is a Ruby implementation of Object Prevalence mime-types 1.15 [www] Manages a MIME Content-Type that will return the Content-Type for a given filename. mysql 2.7 [www] MySQL/Ruby provides the same functions for Ruby programs that the MySQL C API provides for C programs. PageTemplate 2.2.0 [www] A simple templating system for Web sites. ParseTree 1.3.7 [www] - depends on RubyInline. Extract and enumerate ruby parse trees. Executables are parse_tree_abc, parse_tree_deps, parse_tree_show. ParseTree 1.4.1 [www] - depends on RubyInline. Extract and enumerate ruby parse trees. Executables are parse_tree_abc, parse_tree_deps, parse_tree_show. payment 1.0.1 [www] Payment is used to process credit cards and electronic cash through merchant accounts. pdf-writer 1.1.3 [www] - depends on color-tools, transaction-simple. A pure Ruby PDF document creation library. Executable is techbook. podcast 0.0.4 [www] Create podcasts from MP3 files Executable is podcast. rails 1.1.5 [www] - depends on actionmailer, actionpack, actionwebservice, activerecord, activesupport, rake. Web-application framework with template engine, control-flow layer, and ORM. Executable is rails. rake 0.7.1 [www] Ruby based make-like utility. Executable is rake. RedCloth 3.0.4 [www] RedCloth is a module for using Textile and Markdown in Ruby. Textile and Markdown are text formats. A very simple text format. Another stab at making readable text that can be converted to HTML. Executable is redcloth. rflickr 2006.02.01 [www] - depends on mime-types. Ruby interface to the Flickr API rmagick 1.12.0 [www] RMagick is an interface between the Ruby programming language and the ImageMagick and GraphicsMagick image processing libraries. RubyInline 3.5.0 [www] Multi-language extension coding within ruby. Executable is inline_package. rubyslippers 1.03 [www] RubySlippers is a GUI wrapper for RubyGems using RubyWebDialogs. Executable is rubyslippers. rubyzip 0.5.12 [www] rubyzip is a ruby module for reading and writing zip files rubyzip 0.5.8 [www] rubyzip is a ruby module for reading and writing zip files ruwiki 0.9.3 [www] - depends on archive-tar-minitar, diff-lcs. A simple, extensible, and fast Wiki-clone. Executables are ruwiki, ruwiki.cgi, ruwiki_convert, ruwiki_service.rb, ruwiki_servlet. shipping 1.3.0 [www] - depends on builder. A general shipping module to find out the shipping prices via UPS or FedEx. shorturl 0.8.3 [www] Shortens URLs using services such as TinyURL and RubyURL Executable is shorturl. sqlite-ruby 2.2.3 [www] SQLite/Ruby is a module to allow Ruby scripts to interface with a SQLite database. syntax 1.0.0 [www] Syntax is Ruby library for performing simple syntax highlighting. Technorati-Ruby 0.1.0 [www] Technorati(http://technorati.com/) bindings for Ruby. tidy 1.1.2 [www] Ruby interface to HTML Tidy Library Project transaction-simple 1.3.0 [www] Simple object transaction support for Ruby. webgen 0.3.8 [www] - depends on cmdparse. Webgen is a templated based static website generator. Executable is webgen. wee 0.10.0 [www] Wee is a framework for building highly dynamic web applications. Executable is wee. xml-simple 1.0.8 [www] A very simple API for XML processing.</pre> ==把已有的Ruby应用程序与Rails版本1.1.2融合到一起== 运行Hosting Configuration 2.0的Deluxe及Premium托管账户上已有Rails 1.1.2版本。这个版本的Rails在开发Gem路径里,这样不会影响到已有Ruby应用程序的功能。 要利用这个版本的Rails的话,把如下代码添加到你的应用程序的config/environment.rb文档里: ENV['GEM_HOME'] = '/usr/local/lib/ruby/gems-dev/1.8' 注: 要确保能够正常访问路径的话,这行(代码)必须要在call to Rails::Initializer之前出现. 这个位置也是将来的Rails版本要存在的位置。要确保已有应用程序与将来的Gem版本的兼容性的话,你可以冻结Gems或者使用Ruby的require_gem命令来指定Gem版本。 获得有关冻结Gems的信息的话,见What does it mean to freeze Ruby Gems?. 获得有关require_gem的信息的话, 见Specifying Gem versions. 要查看当前你的共享托管服务器上安装了的Gems列表的话,见What Ruby Gems are installed on my hosting account?. =Troubleshooting Articles= ==如何启用.NET显示详细的错误信息?== <pre>默认状态下,一旦有什么.NET应用程序产生某exception的话,Windows托管服务器就会显示一个一般错误。这个错误信息与下面类似: Server Error in '/mytestapp' Application. Runtime Error Description: 服务器上发生应用错误。当前自定义的错误设置阻止应用错误细节显示出来。 Details: 要想使这个具体的错误信息的细节可在本地服务器上进行查看的话,在当前Web应用程序的根目录里的"web.config"配置文档里创建一个<customErrors>标签。 这个<customErrors>标签的"mode"属性要设置成"RemoteOnly". 要启用在远程机器上能够查看细节的话,把"mode"设置成"Off". <!-- Web.Config Configuration File --> <configuration> <system.web> <customErrors mode="RemoteOnly"/> </system.web> </configuration> Notes: 你看到的当前错误页面可以通过把应用程序的<customErrors>配置标签的"defaultRedirect"属性指向一个自定义的错误页URL来替换掉。 <!-- Web.Config Configuration File --> <configuration> <system.web> <customErrors mode="On"default Redirect="mycustompage.htm"/> </system.web> </configuration> 我们把主机这么设置是为了安全考虑。显示某个自定义错误信息时,某个恶意用户可能从这一信息中获取敏感信息。这就是为何我们建议除非在解决什么难题时,否则尽量 不要使用这一特征。此外,问题解决好后,确保重新启用普通错误信息。 要远程查看错误信息的细节的话,在你的应用程序文件夹的根部里的web.config 文档更改如下标签。如果该标签不存在的话,你可以在<configuration>及<system.web>里自行添加它: <customErrors mode="Off"/> 要指定某自定义错误页而不是详细的错误讯息显示出来的话,添加如下标签: <customErrors mode="On" defaultRedirect =”~/MyErrorPage.aspx”/> 这里, MyErrorPage.aspx 即是你的错误页的名称。 Mode Values:/模式参数: 有几种模式参数。 RemoteOnly:/仅远程 Only users logged on to the console of the server can view the detailed error messages. Remote users will see the generic error page unless the defaultRedirect is defined, in which case the custom page is displayed. On: 没有详细的错误信息显示。如果指定了自定义错误页的话,它将在默认Redirect里显示出来。 Off: 为远程及本地用户显示详细的错误信息。使用这个参数来设置模式参数。 默认的Redirect参数是在遇到某个.NET错误时用来指定使用的错误页的。这个URL是相对于你的web.config文档的位置而言的;或者使用了tilde的话,是相对于你的应用 程序的根部而言的(例如: ~/MyErrorPage.aspx).</pre> =Hosting 2.0= ==如何管理Hosting Configuration 2.0?== 注: 此文仅适用于运行Hosting Configuration 2.0的Linux Deluxe及 Premium主机 你可以通过CGI Admin网页管理你的新的托管配置。 管理你的Hosting Configuration 2.0设置 1. 登陆你的Account Manager. 2. 在My Products 部分选择Hosting Account List. 3. 在你想更改的托管帐户旁边点击Open. 4. 在Hosting Control Center里的Content 部分点击CGI Admin 图标。 5. 在Ruby, Perl, PHP,及 Processes 键下可找到新托管配置的功能。 ==如何知道主机运行的配置?== 运行Hosting Configuration 2.0的托管帐户受益于高性能、安全度高及其他功能。要升级的话,见H How do I upgrade my hosting account to run Hosting Configuration 2.0?. 注: Hosting Configuration选项仅在Linux 共享托管账户上有。Windows虚拟主机使用标准配置,不需要升级。 确定主机配置 1.登陆Account Manager. 2.在My Products 部分选择Hosting Account List. 3.在你想更改的托管帐户旁边点击Open. 4.Account Summary 部分即是你的帐户运行使用的Hosting Configuration. ==Hosting Configuration 2.0提供什么新的功能?== 注: Hosting Configuration选项仅在Linux 共享托管账户上有。Windows虚拟主机使用标准配置,不需要升级。 升级到Hosting Configuration 2.0会有如下益处: •5/支持PHP5 有了这一支持,你可以使用这一最新版本的服务器端脚本语言进行编程,利用已有应用程序,添加在PHP5里编的 ons. 在同以站点上你可以运行PHP 及PHP 5. •支持使用最新版本的Python -- 2.4. •支持Ruby及Ruby on Rails 支持使用Ruby脚本语言及其应用程序框架Ruby on Rails. 新的主机配置还融合了FastCGI来优化Ruby on Rails的性能。 •Scripting Flexibility/脚本灵活性 CGI, Perl,及Python脚本不一定需要上载到cgi目录并在其中运行。新的主机配置允许任何.cgi, .py,或者 .pl 扩展名从网站内的任何文件夹运行。 •自定义PHP 4及PHP 5初始化文档 你现在可以在你的站点的根部通过创建PHP初始化文档来自定义你的网站,以管理form, 服务器,环境方面的变量,服务器端cookies,临时目录,错误显示,及错误日志. •Administration/管理 新托管配置有个专门的管理界面,你可以在这里管理并维护cgi apps, 脚本库版本,Perl及Ruby on Rails. ==如何升级托管帐户使之运行Hosting Configuration 2.0?== 我们推荐你升级你的主机帐户,使之运行Hosting Configuration 2.0. 你可以在你的客户帐户的Hosting Control Center 的Account Summary 部分查看你的托管的当前配置。获得有关升级的可能带来的风险的信息,见What are the risks of upgrading to Hosting Configuration 2.0?. 注: Hosting Configuration选项仅在Linux 共享托管账户上有。Windows共享托管帐户使用标准配置,不需要升级。 升级到Hosting Configuration 2.0 1. 登陆Account Manager. 2. 在My Products 部分选择Hosting Account List. 3. 在你想更改的托管帐户旁边点击Open. 4. 在Hosting Control Center 的Account Summary 部分,选中Upgrade Hosting Configuration 2.0 选项框。 5. 点击 Continue. 6. 点击 Submit. 注: 这个更改可能需要24小时的传播时间。 ==升级到Hosting Configuration 2.0有什么风险?== 注: Hosting Configuration选项仅在Linux 共享托管账户上有。Windows共享托管帐户使用标准配置,不需要什么升级。 在升级到Hosting Configuration 2.0前, 要意识到升级后你的站点可能遇到一些技术方面的问题,这点很重要。安全目的,新的主机配置禁止使 用"exec cmd"从服务器端include-enabled页面执行程序。任何使用这一方法的代码在升级后都不能正常工作。 ==我从hosting configuration 1.0升级到了2.0。是否需要更改我的脚本文档扩展名?== 任何之前的脚本不需要什么更改就能运行。但是,如果你希望已有的PHP 解析为 PHP5, 你需要把文档扩展名改为".php5". =Perl= ==使用CGI/Perl连接到某MySQL数据库== 本列描述的是使用CGI/Perl 连接到一MySQL 数据库。 #!/usr/bin/perl -T print "ContentType: text/htmlnn"; use DBI; # Connecting to the database # Replace DATABASENAME with the name of the database, # HOSTNAME with the hostname/ip address of the MySQL server. $drh = DBI->install_driver("mysql"); $dsn = "DBI:mysql:database=your_databasename;host=mysql.secureserver.net"; $dbh = DBI->connect($dsn,"your_dbusername","your_dbpassword"); # Select the data and display to the browser my $sth = $dbh->prepare("SELECT * FROM customers"); $sth->execute(); while (my $ref = $sth->fetchrow_hashref()) { print "Found a row: id = $ref->{'id'}, name = $ref->{'name'}n"; } $sth->finish(); # Disconnect from the database. $dbh->disconnect(); ==如何启用CGI错误收集?== 注: 本文仅适用于运行Hosting Configuration 2.0的Deluxe及Premium 启用CGI错误收集能够让你在24小时内查看你的站点的错误日志,过了这段时间错误收集停止,错误日志也没法再查看。如果你在错误收集期间扩 展过期日期的话,所有已有的错误日志都会被删除,收集过程从头开始。 获得有关查看错误日志的信息,见How do I view my CGI error logs?. 启用CGI错误收集 1. 登陆你的Account Manager. 2. 在My Products 部分选择Hosting Account List. 3. 在你想更改的托管账户旁边点击Open. 4. 在Hosting Control Center的Settings 部分点击Error Logs图标。 5. 点击Update. What email or relay server should I use in my Perl code?/Perl代码里可以使用什么电子邮件或者relay服务器? 如果你的Perl脚本使用的是/usr/lib/sendmail binary, 你不需要指定往外发送邮件的服务器。如果你用的是/usr/lib/sendmail binary 之外的某种方式, 把relay-hosting.secureserver.net做为你的relay服务器使用。 注: 安全目的,我们不支持使用Sockets Perl模块 ==我能给我的托管帐户添加Perl模块吗?== 目前我们不能给服务器添加额外的Perl模块。尽管如此,很多常见的Perl模块都已安装,以供使用。要见完整的列表的话: 1. 登陆你的Account Manager. 2. 在My Products 部分选择Hosting Account List. 3. 在你想更改的托管帐户旁边点击Open. 4. 在Content 部分点击CGI Admin, 根据提示输入你的托管账户用户名及密码。 5. 在CGI Administration 窗口,点击Perl 选项,然后点击Display按钮, 这样就会列出所有目前安装的Perl模块。 What Paths do I Use to Upload PERL Files and Use the PERL Interpreter?/上载PERL文件及使用PERL编译器所使用的路径是什么? 默认状态下,你可以使用任何一个下面的文档路径来发布你的PERL文档: • /home/content/u/s/e/username/html/file.pl • FTP to /file.pl • For hosting config 2.0, you can use any directory. 注: 你必须在文档工作前指定其执行许可权。 如果你有的是启用了CGI/Perl或者 Java 的帐户,到我们的Perl编译器的系统路径是: #!/usr/bin/perl CGI binaries必须以.cgi或者 .pl结尾,必须要在/cgi目录才可使用。在我们的托管系统上不能使用/cgi-bin/. Example of a Test PERL Script/ 一个Test PERL Script示例 #!/usr/bin/perl print "Content-type: text/html\n\n"; print "Greetings user.\n"; SSI/SHTML Articles ==为何在我的SSI/SHTML文档里不能使用exec cmd了?== 如果你运行的是Hosting Configuration 2.0, 安全原因,"exec cmd"已被禁用。你还是可以使用"exec cgi"执行cgi脚本。服务器端脚本可以通过include file运行。其句法如下所示: <!--#include virtual="[file path/file name]"--> Include文档的首行代码应该是: print "content-type: text/htmlnn" 使用include file的好处在于你可以pass query string values. 这些文档必须要存在于一个你能运行cgi脚本的目录里。在 Hosting Configuration 2.0下面,它可以是你的站点里的任何目录。 =HTML/CSS= ==什么是HTML?== HTML (或者XHTML)是用来创建网页的编码语言。使用HTML, 你以"tags(标签)"来包围一片文本,这些标签指示的是文本该如何显示或者是它在某文档中的作用。例如: <h1>This is a Heading</h1> <p>This is a paragraph in an HTML document. 此段开始位置有个"p tag", 结束时有个结束的"p tag". 这些标签告诉Web浏览器如何显示该文本。 见Where can I learn more about HTML? 获得更多连接到更多有关如何使用HTML信息的网站的链接。 ==获得更多HTML有关的信息?== HTML (或XHTML) 是用来创建网页的编码语言。使用HTML,你以代码来包围一片文本,这些代码指示文本该如何显示或者是它在某文档中的作用。 这里是网络上你可以学习更多有关HTML的信息的地方: The W3C's HyperText Markup Language (HTML) Home Page W3 School's HTML Tutorial W3 School's XHTML Tutorial Webmonkey's HTML Basics ==不懂HTML,如何创建网站?== 即使你不懂HTML语言,也有几种工具可以帮助你创建一个网站。创建一个网站的最常用工具是WYSIWYG (读成 whi-zee-wig)或者 What You See Is What You Get编辑器。 使用这些编辑器的方式与使用桌面排版应用程序如 Microsoft Word或 WordPerfect差不多。 这些是一些常用的WYSIWYG编辑器: • Macromedia Dreamweaver • Microsoft FrontPage • Adobe GoLive 除了一个WYSIWYG编辑器外,你也可以在你的Web服务器上安装一个博客或者内容管理应用程序。这些应用程序让你能够用用户友好界面来创建、管理你的网站。 =Python= ==我的托管帐户上到Python的路径是什么?== 你可以在我们的共享托管帐户上同时使用CGI与Python,以创建互动性更强的网站。 要使用Python的话,你需要知道Python安装在服务器的什么地方。我们的服务器上到Python的路径是: /usr/bin/python Managing Python script file extensions under Hosting Configuration 2.0/在Hosting Configuration 2.0 下面管理Python脚本文档扩展 运行Hosting Configuration 2.0的托管帐户可选择使用Python版本2.2, 2.3, 及2.4. 如果在脚本中已经指定了版本,在不同Python版本下运行的文档都能使用.py扩展名。 要指定版本的话,在Python脚本中输入下列当中的任何一个: *Python 2.2 *#!/usr/bin/python *Python 2.3 *#!/usr/bin/python2.3 *Python 2.4 *#!/usr/bin/python2.4 ==什么是Python?== Python是一种类似Perl的常用解释性强,、互动性好、面向对象的编程语言。你可以在启用了CGI的Linux虚拟主机上使用Python. Python以用途广泛、句法清晰而著称。 获得更多有关Python的信息,访问Python Web site. ==/为何我的Python脚本没起作用?== 检查下你的Python脚本是否是"unix text file format." 如果它是在一个"DOS/Windows text file format," Python将无法正确解译之。 要解决这个问题的话,以"ASCII"模式而不是"binary"模式上载你的Python脚本。你的FTP服务器就能够把脚本解译到正确格式了。 ==Python代码里需要使用什么电子邮件或者ralay服务器?== 在你的Python代码里使用如下relay服务器:relay-hosting.secureserver.net 不需要为该relay服务器提供用户名及密码。
返回到
Linux主机的语言
。
个人工具
登录
名字空间
页面
讨论
变换
查看
阅读
查看源代码
查看历史
动作
搜索
导航
首页
美国主机侦探论坛
当前事件
最近更改
随机页面
帮助
工具/资源
查询Alexa排名
Gzip压缩检测
建站源代码下载
工具箱
链入页面
链出更改
特殊页面