Translation

(itstool) path: sect3/para
It is necessary to pass the output to a pager, such as the <command>more</command> or <command>less</command> to easier digest the amount of output.
85/1480
Context English Chinese (Simplified) (zh_CN) State
<prompt>#</prompt> <userinput>pkg search php</userinput> <prompt>#</prompt> <userinput>pkg search php</userinput>
A list will be displayed including the versions and additional features they provide. The components are completely modular, meaning features are enabled by installing the appropriate port. To install <acronym>PHP</acronym> version 7.4 for Apache, issue the following command: 将显示一个列表,内涵版本号和功能说明。这些组件是完全模块化的,这意味着通过安装相应的 Port 来启用功能。要安装<acronym>PHP</acronym>7.4版本的Apache,请执行以下命令:
<prompt>#</prompt> <userinput>pkg install mod_php74</userinput> <prompt>#</prompt> <userinput>pkg install mod_php74</userinput>
If any dependency packages need to be installed, they will be installed as well. 其他依赖包也可以用此方法安装。
By default, <acronym>PHP</acronym> will not be enabled. The following lines will need to be added to the Apache configuration file located in <filename role="directory">/usr/local/etc/apache24</filename> to make it active: 默认情况下 <acronym>PHP</acronym> 不启用。将以下行添加到 <filename role="directory">/usr/local/etc/apache24</filename> 来启用此功能:
&lt;FilesMatch "\.php$"&gt;
SetHandler application/x-httpd-php
&lt;/FilesMatch&gt;
&lt;FilesMatch "\.phps$"&gt;
SetHandler application/x-httpd-php-source
&lt;/FilesMatch&gt;
&lt;FilesMatch "\.php$"&gt;
SetHandler application/x-httpd-php
&lt;/FilesMatch&gt;
&lt;FilesMatch "\.phps$"&gt;
SetHandler application/x-httpd-php-source
&lt;/FilesMatch&gt;
In addition, the <option>DirectoryIndex</option> in the configuration file will also need to be updated and Apache will either need to be restarted or reloaded for the changes to take effect. 此外,配置文件中的 <option>DirectoryIndex</option> 也需要更新,Apache需要重新启动或重新加载才能生效。
Support for many of the <acronym>PHP</acronym> features may also be installed by using <command>pkg</command>. For example, to install support for <acronym>XML</acronym> or <acronym>SSL</acronym>, install their respective ports: 其他 <acronym>PHP</acronym> 模块可以使用 <command>pkg</command> 安装。例如安装 <acronym>XML</acronym> 模块或 <acronym>SSL</acronym> 模块,使用以下命令安装:
<prompt>#</prompt> <userinput>pkg install php74-xml php74-openssl</userinput> <prompt>#</prompt> <userinput>pkg install php74-xml php74-openssl</userinput>
As before, the Apache configuration will need to be reloaded for the changes to take effect, even in cases where it was just a module install. 和之前一样,Apache的配置需要重新加载才能生效,即使在只是安装模块的情况下也是如此。
To perform a graceful restart to reload the configuration, issue the following command: 使用以下命令重启 Apache 来载入配置文件:
<prompt>#</prompt> <userinput>apachectl graceful</userinput> <prompt>#</prompt> <userinput>apachectl graceful</userinput>
Once the install is complete, there are two methods of obtaining the installed <acronym>PHP</acronym> support modules and the environmental information of the build. The first is to install the full <acronym>PHP</acronym> binary and running the command to gain the information: 安装完成后,有两种方法可以获得 <acronym>PHP</acronym> 支持模块信息和当前版本的编译参数。第一种是安装完整的 <acronym>PHP</acronym> 二进制程序并执行命令获取信息:
<prompt>#</prompt> <userinput>pkg install php74</userinput> <prompt>#</prompt> <userinput>pkg install php74</userinput>
<prompt>#</prompt> <userinput>php -i |less</userinput> <prompt>#</prompt> <userinput>php -i |less</userinput>
It is necessary to pass the output to a pager, such as the <command>more</command> or <command>less</command> to easier digest the amount of output. 在碰到大量输出文本时,可以将其重定向到分页器,比如 <command>more</command> 或 <command>less</command>,让阅读变得更方便。
Finally, to make any changes to the global configuration of <acronym>PHP</acronym> there is a well documented file installed into <filename role="directory">/usr/local/etc/php.ini</filename>. At the time of install, this file will not exist because there are two versions to choose from, one is <filename>php.ini-development</filename> and the other is <filename>php.ini-production</filename>. These are starting points to assist administrators in their deployment. 最后,如果需要修改<acronym>PHP</acronym>的全局配置信息,编辑 <filename role="directory">/usr/local/etc/php.ini</filename> 。安装时这个文件不存在,有两个版本可供选择,一个是 <filename>php.ini-development</filename> ,另一个是 <filename>php.ini-production</filename>。这两个文件可帮助管理员进行快速配置。
HTTP2 Support HTTP2 支持
<application>Apache</application> support for the <acronym>HTTP</acronym>2 protocol is included by default when installing the port with <command>pkg</command>. The new version of <acronym>HTTP</acronym> includes many improvements over the previous version, including utilizing a single connection to a website, reducing overall roundtrips of <acronym>TCP</acronym> connections. Also, packet header data is compressed and <acronym>HTTP</acronym>2 requires encryption by default. 使用 <command>pkg</command> 安装的 <application>Apache</application>,默认启用 <acronym>HTTP</acronym>2 协议支持。新版本的 <acronym>HTTP</acronym> 与之前的版本相比有许多改进,包括利用单个连接到网站,减少 <acronym>TCP</acronym> 握手次数。此外,数据包头数据已被压缩,<acronym>HTTP</acronym>2 默认需要加密。
When <application>Apache</application> is configured to only use <acronym>HTTP</acronym>2, web browsers will require secure, encrypted <acronym>HTTPS</acronym> connections. When <application>Apache</application> is configured to use both versions, <acronym>HTTP</acronym>1.1 will be considered a fall back option if any issues arise during the connection. 当 <application>Apache</application> 配置为只使用 <acronym>HTTP</acronym>2 时,网络浏览器将使用 <acronym>HTTPS</acronym> 协议。当<application>Apache</application> 被配置为使用两个版本时,如果在连接过程中出现任何问题,<acronym>HTTP</acronym> 1.1将被视为后备选项。
While this change does require administrators to make changes, they are positive and equate to a more secure Internet for everyone. The changes are only required for sites not currently implementing <acronym>SSL</acronym> and <acronym>TLS</acronym>. 虽然这一变化需要管理员做出,但它们是积极的,为每个人提供了一个更安全的互联网连接。只有目前没有使用<acronym>SSL</acronym>和<acronym>TLS</acronym>的网站才需要进行更改。
This configuration depends on the previous sections, including <acronym>TLS</acronym> support. It is recommended those instructions be followed before continuing with this configuration. 此配置与前述章节相关,例如 <acronym>TLS</acronym> 支持。建议在继续进行配置之前,先遵循这些说明。
Start the process by enabling the <acronym>http</acronym>2 module by uncommenting the line in <filename>/usr/local/etc/apache24/httpd.conf</filename> and replace the mpm_prefork module with mpm_event as the former does not support <acronym>HTTP</acronym>2. 取消<filename>/usr/local/etc/apache24/httpd.conf</filename>中相关行的注释来启用<acronym>http</acronym>2模块,用 pmm_event 替换 pmm_prefork 模块,因为前者不支持 <acronym>HTTP</acronym>2。
LoadModule http2_module libexec/apache24/mod_http2.so
LoadModule mpm_event_module libexec/apache24/mod_mpm_event.so
LoadModule http2_module libexec/apache24/mod_http2.so
LoadModule mpm_event_module libexec/apache24/mod_mpm_event.so
There is a separate <filename role="port">mod_http2</filename> port that is available. It exists to deliver security and bug fixes quicker than the module installed with the bundled <filename role="port">apache24</filename> port. It is not required for <acronym>HTTP</acronym>2 support but is available. When installed, the <filename>mod_h2.so</filename> should be used in place of <filename>mod_http2.so</filename> in the <application>Apache</application> configuration.
There are two methods to implement <acronym>HTTP</acronym>2 in <application>Apache</application>; one way is globally for all sites and each VirtualHost running on the system. To enable <acronym>HTTP</acronym>2 globally, add the following line under the ServerName directive:
Protocols h2 http/1.1 Protocols h2 http/1.1
To enable <acronym>HTTP</acronym>2 over plaintext, use <acronym>h2</acronym> <acronym>h2c</acronym> <acronym>http</acronym>/1.1 in the <filename>httpd.conf</filename>. 为启用 <acronym>HTTP</acronym>2 over plaintext,在 <filename>httpd.conf</filename> 写入 <acronym>h2</acronym> <acronym>h2c</acronym> <acronym>http</acronym>/1.1。
Having the <acronym>h2c</acronym> here will allow plaintext <acronym>HTTP</acronym>2 data to pass on the system but is not recommended. In addition, using the <acronym>http</acronym>/1.1 here will allow fallback to the <acronym>HTTP</acronym>1.1 version of the protocol should it be needed by the system. 在这里使用<acronym>h2c</acronym>将允许纯文本<acronym>HTTP</acronym>2数据在系统中传递,但不建议使用。此外,在这里使用 <acronym>http</acronym>/1.1 将允许在系统需要时回退到 <acronym>HTTP</acronym>1.1 。
To enable <acronym>HTTP</acronym>2 for individual VirtualHosts, add the same line within the VirtualHost directive in either <filename>httpd.conf</filename> or <filename>httpd-ssl.conf</filename>.
Reload the configuration using the <command>apachectl</command> <parameter>reload</parameter> command and test the configuration either by using either of the following methods after visiting one of the hosted pages: 使用<command>apachectl</command> <parameter>reload</parameter>命令重新加载配置,并在访问其中一个托管页面后使用以下任一方法测试配置:

Loading…

It is necessary to pass the output to a pager, such as the <command>more</command> or <command>less</command> to easier digest the amount of output.
在碰到大量输出文本时,可以将其重定向到分页器,比如 <command>more</command> 或 <command>less</command>,让阅读变得更方便。
a month ago
Browse all component changes

Glossary

English Chinese (Simplified) (zh_CN)
No related strings found in the glossary.

Source information

Source string comment
(itstool) path: sect3/para
Source string location
book.translate.xml:56710
String age
a month ago
Source string age
a month ago
Translation file
books/zh_CN/handbook.po, string 9278