📄 install.unix.html
字号:
15. You can edit /usr/local/lib/php.ini file to set PHP options. Edit your httpd.conf or srm.conf file and add: AddType application/x-httpd-php .php</pre></div> </pre></div> </div> <blockquote><p><b class="note">Note</b>: Replace <i>php-5</i> by <i>php-4</i> and <i>php5</i> by <i>php4</i> in PHP 4. <br /> </p></blockquote> <p class="para"> Depending on your Apache install and Unix variant, there are many possible ways to stop and restart the server. Below are some typical lines used in restarting the server, for different apache/unix installations. You should replace <i>/path/to/</i> with the path to these applications on your systems. </p> <p class="para"> <div class="example"> <p><b>Example #3 Example commands for restarting Apache</b></p> <div class="example-contents"><div class="cdata"><pre>1. Several Linux and SysV variants:/etc/rc.d/init.d/httpd restart2. Using apachectl scripts:/path/to/apachectl stop/path/to/apachectl start3. httpdctl and httpsdctl (Using OpenSSL), similar to apachectl:/path/to/httpsdctl stop/path/to/httpsdctl start4. Using mod_ssl, or another SSL server, you may want to manuallystop and start:/path/to/apachectl stop/path/to/apachectl startssl</pre></div> </div> </div> </p> <p class="para"> The locations of the apachectl and http(s)dctl binaries often vary. If your system has <i>locate</i> or <i>whereis</i> or <i>which</i> commands, these can assist you in finding your server control programs. </p> <p class="para"> Different examples of compiling PHP for apache are as follows: <div class="informalexample"> <div class="example-contents"><div class="cdata"><pre>./configure --with-apxs --with-pgsql</pre></div> </div> </div> </p> <p class="para"> This will create a <var class="filename">libphp5.so</var> (or <var class="filename">libphp4.so</var> in PHP 4) shared library that is loaded into Apache using a LoadModule line in Apache's <var class="filename">httpd.conf</var> file. The PostgreSQL support is embedded into this library. </p> <p class="para"> <div class="informalexample"> <div class="example-contents"><div class="cdata"><pre>./configure --with-apxs --with-pgsql=shared</pre></div> </div> </div> </p> <p class="para"> This will create a <var class="filename">libphp4.so</var> shared library for Apache, but it will also create a <var class="filename">pgsql.so</var> shared library that is loaded into PHP either by using the extension directive in <var class="filename">php.ini</var> file or by loading it explicitly in a script using the <a href="function.dl.html" class="function">dl()</a> function. </p> <p class="para"> <div class="informalexample"> <div class="example-contents"><div class="cdata"><pre>./configure --with-apache=/path/to/apache_source --with-pgsql</pre></div> </div> </div> </p> <p class="para"> This will create a <var class="filename">libmodphp5.a</var> library, a <var class="filename">mod_php5.c</var> and some accompanying files and copy this into the <i>src/modules/php5</i> directory in the Apache source tree. Then you compile Apache using <i>--activate-module=src/modules/php5/libphp5.a</i> and the Apache build system will create <var class="filename">libphp5.a</var> and link it statically into the <var class="filename">httpd</var> binary (replace <i>php5</i> by <i>php4</i> in PHP 4). The PostgreSQL support is included directly into this <var class="filename">httpd</var> binary, so the final result here is a single <var class="filename">httpd</var> binary that includes all of Apache and all of PHP. </p> <p class="para"> <div class="informalexample"> <div class="example-contents"><div class="cdata"><pre>./configure --with-apache=/path/to/apache_source --with-pgsql=shared</pre></div> </div> </div> </p> <p class="para"> Same as before, except instead of including PostgreSQL support directly into the final <var class="filename">httpd</var> you will get a <var class="filename">pgsql.so</var> shared library that you can load into PHP from either the <var class="filename">php.ini</var> file or directly using <a href="function.dl.html" class="function">dl()</a>. </p> <p class="para"> When choosing to build PHP in different ways, you should consider the advantages and drawbacks of each method. Building as a shared object will mean that you can compile apache separately, and don't have to recompile everything as you add to, or change, PHP. Building PHP into apache (static method) means that PHP will load and run faster. For more information, see the Apache <a href="http://httpd.apache.org/docs/1.3/dso.html" class="link external">» web page on DSO support</a>. </p> <blockquote><p><b class="note">Note</b>: Apache's default <var class="filename">httpd.conf</var> currently ships with a section that looks like this: <div class="informalexample"> <div class="example-contents"><div class="cdata"><pre>User nobodyGroup "#-1"</pre></div> </div> </div> Unless you change that to "Group nogroup" or something like that ("Group daemon" is also very common) PHP will not be able to open files. <br /> </p></blockquote> <blockquote><p><b class="note">Note</b>: Make sure you specify the installed version of apxs when using <span class="option">--with-apxs=/path/to/apxs</span>. You must NOT use the apxs version that is in the apache sources but the one that is actually installed on your system. <br /> </p></blockquote> </div> </div><hr /><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="install.general.html">General Installation Considerations</a></div> <div class="next" style="text-align: right; float: right;"><a href="install.unix.apache2.html">Apache 2.0 on Unix systems</a></div> <div class="up"><a href="install.html">Installation and Configuration</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -