首页 > 编程技术 > php

Apache Reference Manual (3)

发布时间:2016-11-25 15:17

ContentDigest directive
Syntax: ContentDigest on|off
Default: ContentDigest off
Context: server config, virtual host, directory, .htaccess
Override: Options
Status: experimental
Compatibility: ContentDigest is only available in Apache 1.1 and later
This directive enables the generation of Content-MD5 headers as defined in RFC1864 respectively RFC2068.
MD5 is an algorithm for computing a "message digest" (sometimes called "fingerprint") of arbitrary-length data, with a high degree of confidence that any alterations in the data will be reflected in alterations in the message digest.
The Content-MD5 header provides an end-to-end message integrity check (MIC) of the entity-body. A proxy or client may check this header for detecting accidental modification of the entity-body in transit. Example header:
     Content-MD5: AuLb7Dp1rqtRtxz2m9kRpA==
Note that this can cause performance problems on your server since the message digest is computed on every request (the values are not cached).
Content-MD5 is only sent for documents served by the core, and not by any module. For example, SSI documents, output from CGI scripts, and byte range responses do not have this header.
--------------------------------------------------------------------------------
CoreDumpDirectory directive
Syntax: CoreDumpDirectory directory
Default: the same location as ServerRoot
Context: server config
Status: core
This controls the directory to which Apache attempts to switch before dumping core. The default is in the ServerRoot directory, however since this should not be writable by the user the server runs as, core dumps won't normally get written. If you want a core dump for debugging, you can use this directive to place it in a different location.
--------------------------------------------------------------------------------
DefaultType directive

在多数WEB开发者眼中,ASP和JSP都被认为是领跑者,而PHP却被认为是个弱小的“挣扎者”,或者说它是一门被贬低为业余者才使用的语言,不值得参与企业WEB开发的竞争。在我看来,PHP没有被当作竞争者的理由是评论者缺乏对它的了解,而且也不了解用于WEB开发的其他操作系统。和一些观点相反,Windows不再占有WEB虚拟主机服务市场的最大份额,我猜想它在WEB开发这一领域里也在被摧城拔寨。

在企业开发里为什么没有PHP?

很显然,PHP被认为落后ASP和JSP太多,以至于它是没有什么用的,但是这恰恰与事实不符。PHP本身就是一门强大的语言。它事实上在每个发行版的Linux上都有,在Mac OS X上也有。获取开发和使用PHP代码的构件(building-block)工具和软件都是免费的。用于开发PHP应用程序的商业集成开发环境(commercial integrated development environments,IDES)也可以找到——这样的工具有Komodo(它运行在Linux和Windows上)和Zend Studio(这个应用程序能够运行在任何带有Java运行环境的操作系统上)。你几乎可以在每个WEB虚拟主机上运行由PHP建立的网站,而不要考虑服务器所运行的是什么操作系统,这一事实让PHP更加具有吸引力。
PHP能够提供什么?
先把PHP周围有什么忘掉一会儿,而考虑一下PHP自身能够提供什么。它是一门强健的服务器端语言,能够提供相当多的功能,而且能够迅速地为页面提供服务。
容易使用
使用C或者Perl或者具有类似风格和句法的另一种语言的任何用户都能够很快上手PHP。尽管它是设计用在WEB上的,但是它也能够作为命令行语言使用。你正在编写的WEB应用程序需要每个小时或者每天执行一次某些代码吗?使用cron或者类似的计划安排管理器,你可以计划安排PHP代码在你希望的时候执行,使用普通的命令解释脚本或者批处理文件就能够执行这样的代码。不需要自动调用浏览器就能够查看专门的网页,从而执行你的事件,也没有必要依赖来访者的点击来告诉你的系统:特定的代码需要在特定的时候被执行。PHP在这一领域可扩展性的事实是绝对具有吸引力的。
PHP的好处
我不是JSP或者ASP的老手,在此我也不想贬低这些语言。相反,我会把注意力放在PHP的好处上。
本地化
PHP让你能够为网站的访问者提供本地化的服务。当用户点击进入网站的时候,网站会根据他们浏览器的设置自动地以其母语向其提供页面。要实现这一点不需要使用用于语言翻译的烦杂文件,而是使用和本地化的C程序所具有的相同能力,通过一个叫做gettext的系统实现的。如果被请求的语言文件存在,那么用户所看到的文本就是其母语;如果语言文件不存在,那么文本就是缺省的英语或者其他任何你所指定的语言。许多本地化的UNIX应用程序都将gettext作为标准,它让第三方的翻译变得轻而易举。
轻易地使用命令行
PHP支持在需要的地方设置和执行命令行程序。使用标准的UNIX diff工具,它能够生成错误最后一次修改同要使用电子邮件发送到错误的所有者的当前注释之间的不同。PHP代码对在系统上所编写的两个文件执行diff,将其输出作为输入,再生成一个要发送的电子邮件。这封电子邮件是通过PHP自己来发送的。

其他好处
上面的只是我在自己程序里所用到的强大功能中的两个,而还其他的功能。例如,你可以:

即时创建简单的Flash动画。
即时创建PDF文档。
使用高级数学功能,以及面向对象的编程技术。
读取和写入到本地和IMAP邮箱。
在PHP里就可以使用任何标准的Internet协议。想要编写基于PHP的FTP、WEB或者新闻客户端?没有问题!只使用PHP你就完全能够编写出使用标准TCP/IP套接字的客户端和服务器,并以此创建自己的协议。
实现对加密的支持,以及对各种数据库服务器的支持。
缺乏远见的评论

我觉得,那些寻找顶级WEB开发语言而排除掉PHP的人是极其短见的。我使用PHP编写代码已经有很多年了,无论是像错误追踪系统这样的高级功能,还是简单地重复使用页眉和页脚这样的普通功能,我都使用PHP编写过。我用PHP编写过半静态的页面,也编写过全功能的多媒体演示。我不是唯一一个使用PHP的人。如果PHP不值得引起注意,如果它只是小儿科或者爱好者的语言,那它为什么会是在WEB开发上成长最快的语言呢?如果它没有ASP或者JSP那么强大,那么它为什么会被用在流量巨大WEB网站上?例如Yahoo,据说它就是由PHP建成的。


开发人员习惯用熟悉的产品

我敢肯定,ASP 和JSP有它们各自的强项,但是我相信人们是用它们不是因为它们能够提供比PHP更加强大的功能,而是因为人们已经了解了它们,并希望以自己习惯的方法编写代码。排除PHP只能表示对这一语言的无知。

<DirectoryMatch>
Syntax: <DirectoryMatch regex> ... </DirectoryMatch>
Context: server config, virtual host
Status: Core.
Compatibility: Available in Apache 1.3 and later
<DirectoryMatch> and </DirectoryMatch> are used to enclose a group of directives which will apply only to the named directory and sub-directories of that directory, the same as <Directory>. However, it takes as an argument a regular expression. For example:
     <DirectoryMatch "^/www/.*/[0-9]{3}">
would match directories in /www/ that consisted of three numbers.
See Also: <Directory> for a description of how regular expressions are mixed in with normal <Directory>s.
See also: How Directory, Location and Files sections work for an explanation of how these different sections are combined when a request is received
--------------------------------------------------------------------------------
DocumentRoot directive
Syntax: DocumentRoot directory-filename
Default: DocumentRoot /usr/local/apache/htdocs
Context: server config, virtual host
Status: core
This directive sets the directory from which httpd will serve files. Unless matched by a directive like Alias, the server appends the path from the requested URL to the document root to make the path to the document. Example:
DocumentRoot /usr/web
then an access to http://www.my.host.com/index.html refers to /usr/web/index.html.
There appears to be a bug in mod_dir which causes problems when the DocumentRoot has a trailing slash (i.e., "DocumentRoot /usr/web/") so please avoid that.
--------------------------------------------------------------------------------
ErrorDocument directive
Syntax: ErrorDocument error-code document
Context: server config, virtual host, directory, .htaccess
Status: core
Override: FileInfo
Compatibility: The directory and .htaccess contexts are only available in Apache 1.1 and later.
ServerRoot directive
Syntax: ServerRoot directory-filename
Default: ServerRoot /usr/local/apache
Context: server config
Status: core
The ServerRoot directive sets the directory in which the server lives. Typically it will contain the subdirectories conf/ and logs/. Relative paths for other configuration files are taken as relative to this directory.
See also the -d option to httpd.
See also the security tips for information on how to properly set permissions on the ServerRoot.
--------------------------------------------------------------------------------
ServerSignature directive
Syntax: ServerSignature Off | On | EMail
Default: ServerSignature Off
Context: server config, virtual host, directory, .htaccess
Status: core
Compatibility: ServerSignature is only available in Apache 1.3 and later.
The ServerSignature directive allows the configuration of a trailing footer line under server-generated documents (error messages, mod_proxy ftp directory listings, mod_info output, ...). The reason why you would want to enable such a footer line is that in a chain of proxies, the user often has no possibility to tell which of the chained servers actually produced a returned error message.
The Off setting, which is the default, suppresses the error line (and is therefore compatible with the behavior of Apache-1.2 and below). The On setting simply adds a line with the server version number and ServerName of the serving virtual host, and the EMail setting additionally creates a "mailto:" reference to the ServerAdmin of the referenced document.
--------------------------------------------------------------------------------
ServerTokens directive
Syntax: ServerTokens Minimal|OS|Full
Default: ServerTokens Full
Context: server config
Status: core
Compatibility: ServerTokens is only available in Apache 1.3 and later
This directive controls whether Server response header field which is sent back to clients includes a description of the generic OS-type of the server as well as information about compiled-in modules.
 PHP是一种领先于ASP的技术。与ASP相比,它具有速度快、稳定性高、跨平台、易学习等优点。ASP学习者使用的OS几乎都是Windows平台,上面无疑都装有IIS。PHP所需求的服务器支持主要是由Apache提供的。事实上,IIS也可以提供这样的支持,具体步骤如下:
    1.    下载PHP。推荐网址:http://www.onlinedown.net/soft/1774.htm    下载后解压到一个文件夹里,推荐解压:C:php 里。以下都将使用这一文件夹描述。
    2.    将C:php里的dlls文件夹里的所有文件复制并粘贴到C:winnt ystem32里。再将C:php下的php4ts.dll复制到C:winnt ystem32下。
    3.    用记事本打开C:php下的php.ini-dist文件。找到如下一行:extension_dir = "./" 将其改为 extension_dir = C:php 将其保存到C:winnt ystem32下,注意:名为php.ini
    4.    首先打开控制面板-〉管理工具-〉internet服务管理器-〉展开左边的目录树-〉默认web站点-〉点击右键-〉属性-〉isapi筛选器->添加->筛选器名称:php;可执行文件:C:php apiphp4isapi.dll 然后再打开默认web站点属性面板下的主目录-〉配置-〉添加-〉可执行文件:C:php apiphp4isapi.dll;扩展名:php。
好了,大功告成了!

标签:[!--infotagslink--]

您可能感兴趣的文章: