📄 apxs.html.en
字号:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><!--
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
This file is generated from xml source: DO NOT EDIT
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
-->
<title>apxs - APache eXtenSion tool - Apache HTTP Server</title>
<link href="../style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
<link href="../style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
<link href="../style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" />
<link href="../images/favicon.ico" rel="shortcut icon" /></head>
<body id="manual-page"><div id="page-header">
<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>
<p class="apache">Apache HTTP Server Version 2.0</p>
<img alt="" src="../images/feather.gif" /></div>
<div class="up"><a href="./"><img title="<-" alt="<-" src="../images/left.gif" /></a></div>
<div id="path">
<a href="http://www.apache.org/">Apache</a> > <a href="http://httpd.apache.org/">HTTP Server</a> > <a href="http://httpd.apache.org/docs/">Documentation</a> > <a href="../">Version 2.0</a> > <a href="./">Programs</a></div><div id="page-content"><div id="preamble"><h1>apxs - APache eXtenSion tool</h1>
<div class="toplang">
<p><span>Available Languages: </span><a href="../en/programs/apxs.html" title="English"> en </a> |
<a href="../ko/programs/apxs.html" hreflang="ko" rel="alternate" title="Korean"> ko </a></p>
</div>
<p><code>apxs</code> is a tool for building and installing extension
modules for the Apache HyperText Transfer Protocol (HTTP) server. This is
achieved by building a dynamic shared object (DSO) from one or more source
or object <var>files</var> which then can be loaded into the Apache server
under runtime via the <code class="directive"><a href="../mod/mod_so.html#loadmodule">LoadModule</a></code>
directive from <code class="module"><a href="../mod/mod_so.html">mod_so</a></code>.</p>
<p>So to use this extension mechanism your platform has to support the DSO
feature and your Apache <code class="program"><a href="../programs/httpd.html">httpd</a></code> binary has to be built with the
<code class="module"><a href="../mod/mod_so.html">mod_so</a></code> module. The <code>apxs</code> tool automatically
complains if this is not the case. You can check this yourself by manually
running the command</p>
<div class="example"><p><code>
$ httpd -l
</code></p></div>
<p>The module <code class="module"><a href="../mod/mod_so.html">mod_so</a></code> should be part of the displayed list.
If these requirements are fulfilled you can easily extend your Apache
server's functionality by installing your own modules with the DSO mechanism
by the help of this <code>apxs</code> tool:</p>
<div class="example"><p><code>
$ apxs -i -a -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 />
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>The arguments <var>files</var> can be any C source file (.c), a object
file (.o) or even a library archive (.a). The <code>apxs</code> tool
automatically recognizes these extensions and automatically used the C
source files for compilation while just using the object and archive files
for the linking phase. But when using such pre-compiled objects make sure
they are compiled for position independent code (PIC) to be able to use them
for a dynamically loaded shared object. For instance with GCC you always
just have to use <code>-fpic</code>. For other C compilers consult its
manual page or at watch for the flags <code>apxs</code> uses to compile the
object files.</p>
<p>For more details about DSO support in Apache read the documentation of
<code class="module"><a href="../mod/mod_so.html">mod_so</a></code> or perhaps even read the
<code>src/modules/standard/mod_so.c</code> source file.</p>
</div>
<div id="quickview"><ul id="toc"><li><img alt="" src="../images/down.gif" /> <a href="#synopsis">Synopsis</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#options">Options</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#examples">Examples</a></li>
</ul><h3>See also</h3><ul class="seealso"><li><code class="program"><a href="../programs/apachectl.html">apachectl</a></code></li><li><code class="program"><a href="../programs/httpd.html">httpd</a></code></li></ul></div>
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="section">
<h2><a name="synopsis" id="synopsis">Synopsis</a></h2>
<p><code><strong>apxs</strong> -<strong>g</strong>
[ -<strong>S</strong> <var>name</var>=<var>value</var> ]
-<strong>n</strong> <var>modname</var></code></p>
<p><code><strong>apxs</strong> -<strong>q</strong>
[ -<strong>S</strong> <var>name</var>=<var>value</var> ]
<var>query</var> ...</code></p>
<p><code><strong>apxs</strong> -<strong>c</strong>
[ -<strong>S</strong> <var>name</var>=<var>value</var> ]
[ -<strong>o</strong> <var>dsofile</var> ]
[ -<strong>I</strong> <var>incdir</var> ]
[ -<strong>D</strong> <var>name</var>=<var>value</var> ]
[ -<strong>L</strong> <var>libdir</var> ]
[ -<strong>l</strong> <var>libname</var> ]
[ -<strong>Wc,</strong><var>compiler-flags</var> ]
[ -<strong>Wl,</strong><var>linker-flags</var> ]
<var>files</var> ...</code></p>
<p><code><strong>apxs</strong> -<strong>i</strong>
[ -<strong>S</strong> <var>name</var>=<var>value</var> ]
[ -<strong>n</strong> <var>modname</var> ]
[ -<strong>a</strong> ]
[ -<strong>A</strong> ]
<var>dso-file</var> ...</code></p>
<p><code><strong>apxs</strong> -<strong>e</strong>
[ -<strong>S</strong> <var>name</var>=<var>value</var> ]
[ -<strong>n</strong> <var>modname</var> ]
[ -<strong>a</strong> ]
[ -<strong>A</strong> ]
<var>dso-file</var> ...</code></p>
</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="section">
<h2><a name="options" id="options">Options</a></h2>
<h3><a name="options.common" id="options.common">Common Options</a></h3>
<dl>
<dt><code>-n <var>modname</var></code></dt>
<dd>This explicitly sets the module name for the <code>-i</code> (install)
and <code>-g</code> (template generation) option. Use this to explicitly
specify the module name. For option <code>-g</code> this is required, for
option <code>-i</code> the <code>apxs</code> tool tries to determine the
name from the source or (as a fallback) at least by guessing it from the
filename.</dd>
</dl>
<h3><a name="options.query" id="options.query">Query Options</a></h3>
<dl>
<dt><code>-q</code></dt>
<dd>Performs a query for <code>apxs</code>'s knowledge about certain
settings. The <var>query</var> parameters can be one or more of the
following strings: <code>CC</code>, <code>CFLAGS</code>,
<code>CFLAGS_SHLIB</code>, <code>INCLUDEDIR</code>, <code>LD_SHLIB</code>,
<code>LDFLAGS_SHLIB</code>, <code>LIBEXECDIR</code>,
<code>LIBS_SHLIB</code>, <code>SBINDIR</code>, <code>SYSCONFDIR</code>,
<code>TARGET</code>.
<p>Use this for manually determining settings. For instance use</p>
<div class="example"><p><code>
INC=-I`apxs -q INCLUDEDIR`
</code></p></div>
<p>inside your own Makefiles if you need manual access to Apache's C
header files.</p></dd>
</dl>
<h3><a name="options.conf" id="options.conf">Configuration Options</a></h3>
<dl>
<dt><code>-S <var>name</var>=<var>value</var></code></dt>
<dd>This option changes the apxs settings described above.</dd>
</dl>
<h3><a name="options.template" id="options.template">Template Generation Options</a></h3>
<dl>
<dt><code>-g</code></dt>
<dd>This generates a subdirectory <var>name</var> (see option
<code>-n</code>) and there two files: A sample module source file named
<code>mod_<var>name</var>.c</code> which can be used as a template for
creating your own modules or as a quick start for playing with the
apxs mechanism. And a corresponding <code>Makefile</code> for even easier
build and installing of this module.</dd>
</dl>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -