github.com/krum110487/go-htaccess@v0.0.0-20240316004156-60641c8e7598/tests/data/apache_2_2_34/manual/programs/apxs.html.en (about)

     1  <?xml version="1.0" encoding="ISO-8859-1"?>
     2  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
     3  <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head>
     4  <meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type" />
     5  <!--
     6          XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
     7                This file is generated from xml source: DO NOT EDIT
     8          XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
     9        -->
    10  <title>apxs - APache eXtenSion tool - Apache HTTP Server Version 2.2</title>
    11  <link href="../style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
    12  <link href="../style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
    13  <link href="../style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" /><link rel="stylesheet" type="text/css" href="../style/css/prettify.css" />
    14  <script src="../style/scripts/prettify.min.js" type="text/javascript">
    15  </script>
    16  
    17  <link href="../images/favicon.ico" rel="shortcut icon" /><link href="http://httpd.apache.org/docs/current/programs/apxs.html" rel="canonical" /></head>
    18  <body id="manual-page"><div id="page-header">
    19  <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p>
    20  <p class="apache">Apache HTTP Server Version 2.2</p>
    21  <img alt="" src="../images/feather.gif" /></div>
    22  <div class="up"><a href="./"><img title="&lt;-" alt="&lt;-" src="../images/left.gif" /></a></div>
    23  <div id="path">
    24  <a href="http://www.apache.org/">Apache</a> &gt; <a href="http://httpd.apache.org/">HTTP Server</a> &gt; <a href="http://httpd.apache.org/docs/">Documentation</a> &gt; <a href="../">Version 2.2</a> &gt; <a href="./">Programs</a></div><div id="page-content"><div class="retired"><h4>Please note</h4>
    25              <p> This document refers to a legacy release (<strong>2.2</strong>) of Apache httpd. The active release (<strong>2.4</strong>) is documented <a href="http://httpd.apache.org/docs/current">here</a>. If you have not already upgraded, please follow <a href="http://httpd.apache.org/docs/current/upgrading.html">this link</a> for more information.</p>
    26          <p>You may follow <a href="http://httpd.apache.org/docs/current/programs/apxs.html">this link</a> to go to the current version of this document.</p></div><div id="preamble"><h1>apxs - APache eXtenSion tool</h1>
    27  <div class="toplang">
    28  <p><span>Available Languages: </span><a href="../en/programs/apxs.html" title="English">&nbsp;en&nbsp;</a> |
    29  <a href="../ko/programs/apxs.html" hreflang="ko" rel="alternate" title="Korean">&nbsp;ko&nbsp;</a> |
    30  <a href="../tr/programs/apxs.html" hreflang="tr" rel="alternate" title="Türkçe">&nbsp;tr&nbsp;</a></p>
    31  </div>
    32  
    33      <p><code>apxs</code> is a tool for building and installing extension
    34      modules for the Apache HyperText Transfer Protocol (HTTP) server. This is
    35      achieved by building a dynamic shared object (DSO) from one or more source
    36      or object <var>files</var> which then can be loaded into the Apache server
    37      under runtime via the <code class="directive"><a href="../mod/mod_so.html#loadmodule">LoadModule</a></code>
    38      directive from <code class="module"><a href="../mod/mod_so.html">mod_so</a></code>.</p>
    39  
    40      <p>So to use this extension mechanism your platform has to support the DSO
    41      feature and your Apache <code class="program"><a href="../programs/httpd.html">httpd</a></code> binary has to be built with the
    42      <code class="module"><a href="../mod/mod_so.html">mod_so</a></code> module. The <code>apxs</code> tool automatically
    43      complains if this is not the case. You can check this yourself by manually
    44      running the command</p>
    45  
    46      <div class="example"><p><code>
    47        $ httpd -l
    48      </code></p></div>
    49  
    50      <p>The module <code class="module"><a href="../mod/mod_so.html">mod_so</a></code> should be part of the displayed list.
    51      If these requirements are fulfilled you can easily extend your Apache
    52      server's functionality by installing your own modules with the DSO mechanism
    53      by the help of this <code>apxs</code> tool:</p>
    54  
    55      <div class="example"><p><code>
    56        $ apxs -i -a -c mod_foo.c<br />
    57        gcc -fpic -DSHARED_MODULE -I/path/to/apache/include -c mod_foo.c<br />
    58        ld -Bshareable -o mod_foo.so mod_foo.o<br />
    59        cp mod_foo.so /path/to/apache/modules/mod_foo.so<br />
    60        chmod 755 /path/to/apache/modules/mod_foo.so<br />
    61        [activating module `foo' in /path/to/apache/etc/httpd.conf]<br />
    62        $ apachectl restart<br />
    63        /path/to/apache/sbin/apachectl restart: httpd not running, trying to start<br />
    64        [Tue Mar 31 11:27:55 1998] [debug] mod_so.c(303): loaded module foo_module<br />
    65        /path/to/apache/sbin/apachectl restart: httpd started<br />
    66        $ _
    67      </code></p></div>
    68  
    69      <p>The arguments <var>files</var> can be any C source file (.c), a object
    70      file (.o) or even a library archive (.a). The <code>apxs</code> tool
    71      automatically recognizes these extensions and  automatically used the C
    72      source files for compilation while just using the object and archive files
    73      for the linking phase. But when using such pre-compiled objects make sure
    74      they are compiled for position independent code (PIC) to be able to use them
    75      for a dynamically loaded shared object. For instance with GCC you always
    76      just have to use <code>-fpic</code>. For other C compilers consult its
    77      manual page or at watch for the flags <code>apxs</code> uses to compile the
    78      object files.</p>
    79  
    80      <p>For more details about DSO support in Apache read the documentation of
    81      <code class="module"><a href="../mod/mod_so.html">mod_so</a></code> or perhaps even read the
    82      <code>src/modules/standard/mod_so.c</code> source file.</p>
    83  </div>
    84  <div id="quickview"><ul id="toc"><li><img alt="" src="../images/down.gif" /> <a href="#synopsis">Synopsis</a></li>
    85  <li><img alt="" src="../images/down.gif" /> <a href="#options">Options</a></li>
    86  <li><img alt="" src="../images/down.gif" /> <a href="#examples">Examples</a></li>
    87  </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><ul class="seealso"><li><a href="#comments_section">Comments</a></li></ul></div>
    88  <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
    89  <div class="section">
    90  <h2><a name="synopsis" id="synopsis">Synopsis</a></h2>
    91      <p><code><strong>apxs</strong> -<strong>g</strong>
    92      [ -<strong>S</strong> <var>name</var>=<var>value</var> ]
    93      -<strong>n</strong> <var>modname</var></code></p>
    94  
    95      <p><code><strong>apxs</strong> -<strong>q</strong>
    96      [ -<strong>S</strong> <var>name</var>=<var>value</var> ]
    97      <var>query</var> ...</code></p>
    98  
    99      <p><code><strong>apxs</strong> -<strong>c</strong>
   100      [ -<strong>S</strong> <var>name</var>=<var>value</var> ]
   101      [ -<strong>o</strong> <var>dsofile</var> ]
   102      [ -<strong>I</strong> <var>incdir</var> ]
   103      [ -<strong>D</strong> <var>name</var>=<var>value</var> ]
   104      [ -<strong>L</strong> <var>libdir</var> ]
   105      [ -<strong>l</strong> <var>libname</var> ]
   106      [ -<strong>Wc,</strong><var>compiler-flags</var> ]
   107      [ -<strong>Wl,</strong><var>linker-flags</var> ]
   108      <var>files</var> ...</code></p>
   109  
   110      <p><code><strong>apxs</strong> -<strong>i</strong>
   111      [ -<strong>S</strong> <var>name</var>=<var>value</var> ]
   112      [ -<strong>n</strong> <var>modname</var> ]
   113      [ -<strong>a</strong> ]
   114      [ -<strong>A</strong> ]
   115      <var>dso-file</var> ...</code></p>
   116  
   117      <p><code><strong>apxs</strong> -<strong>e</strong>
   118      [ -<strong>S</strong> <var>name</var>=<var>value</var> ]
   119      [ -<strong>n</strong> <var>modname</var> ]
   120      [ -<strong>a</strong> ]
   121      [ -<strong>A</strong> ]
   122      <var>dso-file</var> ...</code></p>
   123  </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
   124  <div class="section">
   125  <h2><a name="options" id="options">Options</a></h2>
   126      <h3><a name="options.common" id="options.common">Common Options</a></h3>
   127        <dl>
   128        <dt><code>-n <var>modname</var></code></dt>
   129        <dd>This explicitly sets the module name for the <code>-i</code> (install)
   130        and <code>-g</code> (template generation) option. Use this to explicitly
   131        specify the module name. For option <code>-g</code> this is required, for
   132        option <code>-i</code> the <code>apxs</code> tool tries to determine the
   133        name from the source or (as a fallback) at least by guessing it from the
   134        filename.</dd>
   135        </dl>
   136      
   137  
   138      <h3><a name="options.query" id="options.query">Query Options</a></h3>
   139        <dl>
   140        <dt><code>-q</code></dt>
   141        <dd>Performs a query for <code>apxs</code>'s knowledge about certain
   142        settings. The <var>query</var> parameters can be one or more of the
   143        following strings: <code>CC</code>, <code>CFLAGS</code>,
   144        <code>CFLAGS_SHLIB</code>, <code>INCLUDEDIR</code>, <code>LD_SHLIB</code>,
   145        <code>LDFLAGS_SHLIB</code>, <code>LIBEXECDIR</code>,
   146        <code>LIBS_SHLIB</code>, <code>SBINDIR</code>, <code>SYSCONFDIR</code>,
   147        <code>TARGET</code>.
   148  
   149        <p>Use this for manually determining settings. For instance use</p>
   150        <div class="example"><p><code>
   151          INC=-I`apxs -q INCLUDEDIR`
   152        </code></p></div>
   153  
   154        <p>inside your own Makefiles if you need manual access to Apache's C
   155        header files.</p></dd>
   156        </dl>
   157      
   158  
   159      <h3><a name="options.conf" id="options.conf">Configuration Options</a></h3>
   160        <dl>
   161        <dt><code>-S <var>name</var>=<var>value</var></code></dt>
   162        <dd>This option changes the apxs settings described above.</dd>
   163        </dl>
   164      
   165  
   166      <h3><a name="options.template" id="options.template">Template Generation Options</a></h3>
   167        <dl>
   168        <dt><code>-g</code></dt>
   169        <dd>This generates a subdirectory <var>name</var> (see option
   170        <code>-n</code>) and there two files: A sample module source file named
   171        <code>mod_<var>name</var>.c</code> which can be used as a template for
   172        creating your own modules or as a quick start for playing with the
   173        apxs mechanism. And a corresponding <code>Makefile</code> for even easier
   174        build and installing of this module.</dd>
   175        </dl>
   176      
   177  
   178      <h3><a name="options.dso" id="options.dso">DSO Compilation Options</a></h3>
   179        <dl>
   180        <dt><code>-c</code></dt>
   181        <dd>This indicates the compilation operation. It first compiles the C
   182        source files (.c) of <var>files</var> into corresponding object files (.o)
   183        and then builds a dynamically shared object in <var>dsofile</var> by
   184        linking these object files plus the remaining object files (.o and .a) of
   185        <var>files</var>. If no <code>-o</code> option is specified the output
   186        file is guessed from the first filename in <var>files</var> and thus
   187        usually defaults to <code>mod_<var>name</var>.so</code>.</dd>
   188  
   189        <dt><code>-o <var>dsofile</var></code></dt>
   190        <dd>Explicitly specifies the filename of the created dynamically shared
   191        object. If not specified and the name cannot be guessed from the
   192        <var>files</var> list, the fallback name <code>mod_unknown.so</code> is
   193        used.</dd>
   194  
   195        <dt><code>-D <var>name</var>=<var>value</var></code></dt>
   196        <dd>This option is directly passed through to the compilation command(s).
   197        Use this to add your own defines to the build process.</dd>
   198  
   199        <dt><code>-I <var>incdir</var></code></dt>
   200        <dd>This option is directly passed through to the compilation command(s).
   201        Use this to add your own include directories to search to the build
   202        process.</dd>
   203  
   204        <dt><code>-L <var>libdir</var></code></dt>
   205        <dd>This option is directly passed through to the linker command. Use this
   206        to add your own library directories to search to the build  process.</dd>
   207  
   208        <dt><code>-l <var>libname</var></code></dt>
   209        <dd>This option is directly passed through to the linker command. Use this
   210        to add your own libraries to search to the build process.</dd>
   211  
   212        <dt><code>-Wc,<var>compiler-flags</var></code></dt>
   213        <dd>This option passes <var>compiler-flags</var> as additional flags to
   214        the <code>libtool --mode=compile</code> command. Use this to add local
   215        compiler-specific options.</dd>
   216  
   217        <dt><code>-Wl,<var>linker-flags</var></code></dt>
   218        <dd>This option passes <var>linker-flags</var> as additional
   219        flags to the <code>libtool --mode=link</code> command. Use this
   220        to add local linker-specific options.</dd>
   221        </dl>
   222      
   223  
   224      <h3><a name="options.dsoinstall" id="options.dsoinstall">DSO Installation and Configuration Options</a></h3>
   225      
   226        <dl>
   227        <dt><code>-i</code></dt>
   228        <dd>This indicates the installation operation and installs one or more
   229        dynamically shared objects into the server's <var>modules</var>
   230        directory.</dd>
   231  
   232        <dt><code>-a</code></dt>
   233        <dd>This activates the module by automatically adding a corresponding
   234        <code class="directive"><a href="../mod/mod_so.html#loadmodule">LoadModule</a></code> line to Apache's
   235        <code>httpd.conf</code> configuration file, or by enabling it if it
   236        already exists.</dd>
   237  
   238        <dt><code>-A</code></dt>
   239        <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
   240        sign (<code>#</code>), <em>i.e.</em>, the module is just prepared for
   241        later activation but initially disabled.</dd>
   242  
   243        <dt><code>-e</code></dt>
   244        <dd>This indicates the editing operation, which can be used with the
   245        <code>-a</code> and <code>-A</code> options similarly to the
   246        <code>-i</code> operation to edit Apache's <code>httpd.conf</code>
   247        configuration file without attempting to install the module.</dd>
   248        </dl>
   249      
   250  </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
   251  <div class="section">
   252  <h2><a name="examples" id="examples">Examples</a></h2>
   253      <p>Assume you have an Apache module named <code>mod_foo.c</code> available
   254      which should extend Apache's server functionality. To accomplish this you
   255      first have to compile the C source into a shared object suitable for loading
   256      into the Apache server under runtime via the following command:</p>
   257  
   258      <div class="example"><p><code>
   259        $ apxs -c mod_foo.c<br />
   260        /path/to/libtool --mode=compile gcc ... -c mod_foo.c<br />
   261        /path/to/libtool --mode=link gcc ... -o mod_foo.la mod_foo.slo<br />
   262        $ _
   263      </code></p></div>
   264  
   265      <p>Then you have to update the Apache configuration by making sure a
   266      <code class="directive"><a href="../mod/mod_so.html#loadmodule">LoadModule</a></code> directive is present to
   267      load this shared object. To simplify this step <code>apxs</code> provides
   268      an automatic way to install the shared object in its "modules" directory
   269      and updating the <code>httpd.conf</code> file accordingly. This can be
   270      achieved by running:</p>
   271  
   272      <div class="example"><p><code>
   273        $ apxs -i -a mod_foo.la<br />
   274        /path/to/instdso.sh mod_foo.la /path/to/apache/modules<br />
   275        /path/to/libtool --mode=install cp mod_foo.la /path/to/apache/modules
   276        ...
   277        chmod 755 /path/to/apache/modules/mod_foo.so<br />
   278        [activating module `foo' in /path/to/apache/conf/httpd.conf]<br />
   279        $ _
   280      </code></p></div>
   281  
   282      <p>This way a line named</p>
   283  
   284      <div class="example"><p><code>
   285        LoadModule foo_module modules/mod_foo.so
   286      </code></p></div>
   287  
   288      <p>is added to the configuration file if still not present. If you want to
   289      have this disabled per default use the <code>-A</code> option,
   290      <em>i.e.</em></p>
   291  
   292      <div class="example"><p><code>
   293        $ apxs -i -A mod_foo.c
   294      </code></p></div>
   295  
   296      <p>For a quick test of the apxs mechanism you can create a sample Apache
   297      module template plus a corresponding Makefile via:</p>
   298  
   299      <div class="example"><p><code>
   300        $ apxs -g -n foo<br />
   301        Creating [DIR]  foo<br />
   302        Creating [FILE] foo/Makefile<br />
   303        Creating [FILE] foo/modules.mk<br />
   304        Creating [FILE] foo/mod_foo.c<br />
   305        Creating [FILE] foo/.deps<br />
   306        $ _
   307      </code></p></div>
   308  
   309      <p>Then you can immediately compile this sample module into a shared object
   310      and load it into the Apache server:</p>
   311  
   312      <div class="example"><p><code>
   313        $ cd foo<br />
   314        $ make all reload<br />
   315        apxs -c mod_foo.c<br />
   316        /path/to/libtool --mode=compile gcc ... -c mod_foo.c<br />
   317        /path/to/libtool --mode=link gcc ... -o mod_foo.la mod_foo.slo<br />
   318        apxs -i -a -n "foo" mod_foo.la<br />
   319        /path/to/instdso.sh mod_foo.la /path/to/apache/modules<br />
   320        /path/to/libtool --mode=install cp mod_foo.la /path/to/apache/modules
   321        ...
   322        chmod 755 /path/to/apache/modules/mod_foo.so<br />
   323        [activating module `foo' in /path/to/apache/conf/httpd.conf]<br />
   324        apachectl restart<br />
   325        /path/to/apache/sbin/apachectl restart: httpd not running, trying to start<br />
   326        [Tue Mar 31 11:27:55 1998] [debug] mod_so.c(303): loaded module foo_module<br />
   327        /path/to/apache/sbin/apachectl restart: httpd started<br />
   328        $ _
   329      </code></p></div>
   330  
   331  </div></div>
   332  <div class="bottomlang">
   333  <p><span>Available Languages: </span><a href="../en/programs/apxs.html" title="English">&nbsp;en&nbsp;</a> |
   334  <a href="../ko/programs/apxs.html" hreflang="ko" rel="alternate" title="Korean">&nbsp;ko&nbsp;</a> |
   335  <a href="../tr/programs/apxs.html" hreflang="tr" rel="alternate" title="Türkçe">&nbsp;tr&nbsp;</a></p>
   336  </div><div class="top"><a href="#page-header"><img src="../images/up.gif" alt="top" /></a></div><div class="section"><h2><a id="comments_section" name="comments_section">Comments</a></h2><div class="warning"><strong>Notice:</strong><br />This is not a Q&amp;A section. Comments placed here should be pointed towards suggestions on improving the documentation or server, and may be removed again by our moderators if they are either implemented or considered invalid/off-topic. Questions on how to manage the Apache HTTP Server should be directed at either our IRC channel, #httpd, on Freenode, or sent to our <a href="http://httpd.apache.org/lists.html">mailing lists</a>.</div>
   337  <script type="text/javascript"><!--//--><![CDATA[//><!--
   338  var comments_shortname = 'httpd';
   339  var comments_identifier = 'http://httpd.apache.org/docs/2.2/programs/apxs.html';
   340  (function(w, d) {
   341      if (w.location.hostname.toLowerCase() == "httpd.apache.org") {
   342          d.write('<div id="comments_thread"><\/div>');
   343          var s = d.createElement('script');
   344          s.type = 'text/javascript';
   345          s.async = true;
   346          s.src = 'https://comments.apache.org/show_comments.lua?site=' + comments_shortname + '&page=' + comments_identifier;
   347          (d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s);
   348      }
   349      else { 
   350          d.write('<div id="comments_thread">Comments are disabled for this page at the moment.<\/div>');
   351      }
   352  })(window, document);
   353  //--><!]]></script></div><div id="footer">
   354  <p class="apache">Copyright 2017 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>
   355  <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p></div><script type="text/javascript"><!--//--><![CDATA[//><!--
   356  if (typeof(prettyPrint) !== 'undefined') {
   357      prettyPrint();
   358  }
   359  //--><!]]></script>
   360  </body></html>