⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 apxs.html.en

📁 apache的软件linux版本
💻 EN
📖 第 1 页 / 共 2 页
字号:
    <h3><a name="options.dso" id="options.dso">DSO Compilation Options</a></h3>      <dl>      <dt><code>-c</code></dt>      <dd>This indicates the compilation operation. It first compiles the C      source files (.c) of <var>files</var> into corresponding object files (.o)      and then builds a dynamically shared object in <var>dsofile</var> by      linking these object files plus the remaining object files (.o and .a) of      <var>files</var>. If no <code>-o</code> option is specified the output      file is guessed from the first filename in <var>files</var> and thus      usually defaults to <code>mod_<var>name</var>.so</code>.</dd>      <dt><code>-o <var>dsofile</var></code></dt>      <dd>Explicitly specifies the filename of the created dynamically shared      object. If not specified and the name cannot be guessed from the      <var>files</var> list, the fallback name <code>mod_unknown.so</code> is      used.</dd>      <dt><code>-D <var>name</var>=<var>value</var></code></dt>      <dd>This option is directly passed through to the compilation command(s).      Use this to add your own defines to the build process.</dd>      <dt><code>-I <var>incdir</var></code></dt>      <dd>This option is directly passed through to the compilation command(s).      Use this to add your own include directories to search to the build      process.</dd>      <dt><code>-L <var>libdir</var></code></dt>      <dd>This option is directly passed through to the linker command. Use this      to add your own library directories to search to the build  process.</dd>      <dt><code>-l <var>libname</var></code></dt>      <dd>This option is directly passed through to the linker command. Use this      to add your own libraries to search to the build process.</dd>      <dt><code>-Wc,<var>compiler-flags</var></code></dt>      <dd>This option passes <var>compiler-flags</var> as additional flags to      the compiler command. Use this to add local compiler-specific options.</dd>      <dt><code>-Wl,<var>linker-flags</var></code></dt>      <dd>This option passes <var>linker-flags</var> as additional flags to      the linker command. Use this to add local linker-specific options.</dd>      </dl>        <h3><a name="options.dsoinstall" id="options.dsoinstall">DSO Installation and Configuration Options</a></h3>          <dl>      <dt><code>-i</code></dt>      <dd>This indicates the installation operation and installs one or more      dynamically shared objects into the server's <var>modules</var>      directory.</dd>      <dt><code>-a</code></dt>      <dd>This activates the module by automatically adding a corresponding      <code class="directive"><a href="../mod/mod_so.html#loadmodule">LoadModule</a></code> line to Apache's      <code>httpd.conf</code> configuration file, or by enabling it if it      already exists.</dd>      <dt><code>-A</code></dt>      <dd>Same as option <code>-a</code> but the created <code class="directive"><a href="../mod/mod_so.html#loadmodule">LoadModule</a></code> directive is prefixed with a hash      sign (<code>#</code>), <em>i.e.</em>, the module is just prepared for      later activation but initially disabled.</dd>      <dt><code>-e</code></dt>      <dd>This indicates the editing operation, which can be used with the      <code>-a</code> and <code>-A</code> options similarly to the      <code>-i</code> operation to edit Apache's <code>httpd.conf</code>      configuration file without attempting to install the module.</dd>      </dl>    </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="section"><h2><a name="examples" id="examples">Examples</a></h2>    <p>Assume you have an Apache module named <code>mod_foo.c</code> available    which should extend Apache's server functionality. To accomplish this you    first have to compile the C source into a shared object suitable for loading    into the Apache server under runtime via the following command:</p>    <div class="example"><p><code>      $ apxs -c mod_foo.c<br />      gcc -fpic -DSHARED_MODULE -I/path/to/apache/include -c mod_foo.c<br />      ld -Bshareable -o mod_foo.so mod_foo.o<br />      $ _    </code></p></div>    <p>Then you have to update the Apache configuration by making sure a    <code class="directive"><a href="../mod/mod_so.html#loadmodule">LoadModule</a></code> directive is present to    load this shared object. To simplify this step <code>apxs</code> provides    an automatic way to install the shared object in its "modules" directory    and updating the <code>httpd.conf</code> file accordingly. This can be    achieved by running:</p>    <div class="example"><p><code>      $ apxs -i -a mod_foo.c<br />      cp mod_foo.so /path/to/apache/modules/mod_foo.so<br />      chmod 755 /path/to/apache/modules/mod_foo.so<br />      [activating module `foo' in /path/to/apache/etc/httpd.conf]<br />      $ _    </code></p></div>    <p>This way a line named</p>    <div class="example"><p><code>      LoadModule foo_module modules/mod_foo.so    </code></p></div>    <p>is added to the configuration file if still not present. If you want to    have this disabled per default use the <code>-A</code> option,    <em>i.e.</em></p>    <div class="example"><p><code>      $ apxs -i -A mod_foo.c    </code></p></div>    <p>For a quick test of the apxs mechanism you can create a sample Apache    module template plus a corresponding Makefile via:</p>    <div class="example"><p><code>      $ apxs -g -n foo<br />      Creating [DIR]  foo<br />      Creating [FILE] foo/Makefile<br />      Creating [FILE] foo/mod_foo.c<br />      $ _    </code></p></div>    <p>Then you can immediately compile this sample module into a shared object    and load it into the Apache server:</p>    <div class="example"><p><code>      $ cd foo<br />      $ make all reload<br />      apxs -c mod_foo.c<br />      gcc -fpic -DSHARED_MODULE -I/path/to/apache/include -c mod_foo.c<br />      ld -Bshareable -o mod_foo.so mod_foo.o<br />      apxs -i -a -n "foo" mod_foo.so<br />      cp mod_foo.so /path/to/apache/modules/mod_foo.so<br />      chmod 755 /path/to/apache/modules/mod_foo.so<br />      [activating module `foo' in /path/to/apache/etc/httpd.conf]<br />      apachectl restart<br />      /path/to/apache/sbin/apachectl restart: httpd not running, trying to start<br />      [Tue Mar 31 11:27:55 1998] [debug] mod_so.c(303): loaded module foo_module<br />      /path/to/apache/sbin/apachectl restart: httpd started<br />      $ _    </code></p></div>    <p>You can even use <code>apxs</code> to compile complex modules outside the    Apache source tree, like PHP3:</p>    <div class="example"><p><code>      $ cd php3<br />      $ ./configure --with-shared-apache=../apache-1.3<br />      $ apxs -c -o libphp3.so mod_php3.c libmodphp3-so.a<br />      gcc -fpic -DSHARED_MODULE -I/tmp/apache/include  -c mod_php3.c<br />      ld -Bshareable -o libphp3.so mod_php3.o libmodphp3-so.a<br />      $ _    </code></p></div>    <p>because <code>apxs</code> automatically recognized C source files and    object files. Only C source files are compiled while remaining object    files are used for the linking phase.</p></div></div><div class="bottomlang"><p><span>Available Languages: </span><a href="../en/programs/apxs.html" title="English">&nbsp;en&nbsp;</a> |<a href="../ko/programs/apxs.html" hreflang="ko" rel="alternate" title="Korean">&nbsp;ko&nbsp;</a></p></div><div id="footer"><p class="apache">Copyright 2007 The Apache Software Foundation.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p><p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="../faq/">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p></div></body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -