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

📄 faq.build.html

📁 php的帮助文档,涉及到PHP的案例和基本语法,以及实际应用内容
💻 HTML
📖 第 1 页 / 共 2 页
字号:
         Compile PHP by first running          <strong class="command">./configure --with-apache=/&lt;path&gt;/apache-1.3</strong>         (substitute &lt;path&gt; for the actual path to your apache-1.3 directory.        </span>       </li>       <li class="listitem">        <span class="simpara">         Type <strong class="command">make</strong> followed by <strong class="command">make install</strong>         to build PHP and copy the necessary files to the Apache distribution tree.        </span>       </li>       <li class="listitem">        <span class="simpara">         Change directories into to your <var class="filename">/&lt;path&gt;/apache-1.3/src</var>         directory and edit the <var class="filename">Configuration</var> file.          Add to the file:          <i>AddModule modules/php4/libphp4.a</i>.        </span>       </li>       <li class="listitem">        <span class="simpara">         Type: <strong class="command">./configure</strong> followed by <i>make</i>.        </span>       </li>       <li class="listitem">        <span class="simpara">         You should now have a PHP-enabled httpd binary!        </span>       </li>      </ul>     </p>     <p class="para">      <em class="emphasis">Note:</em> You can also use the new Apache       <i>./configure</i> script. See the instructions in       the <i>README.configure</i> file which is part of       your Apache distribution.  Also have a look at the <var class="filename">INSTALL</var>       file in the PHP distribution.     </p>    </dd>   </dl>   <dl>    <dt><strong>     <p class="para">      I have followed all the steps to install the Apache module version on       Unix, and my PHP scripts show up in my browser or I am being asked to       save the file.     </p>    </strong></dt>    <dd><a name="faq.build.not-running"></a>     <p class="para">      This means that the PHP module is not getting invoked for some reason.      Three things to check before asking for further help:      <ul class="itemizedlist">       <li class="listitem">        <span class="simpara">         Make sure that the httpd binary you are running is the actual          new httpd binary you just built.  To do this, try running:          <i>/path/to/binary/httpd -l</i>        </span>        <span class="simpara">         If you don&#039;t see <var class="filename">mod_php4.c</var> listed then         you are not running the right binary.  Find and install the         correct binary.        </span>       </li>       <li class="listitem">        <span class="simpara">         Make sure you have added the correct Mime Type to one of your          <i>Apache .conf</i> files.  It should be:          <i>AddType application/x-httpd-php .php</i>        </span>        <span class="simpara">          Also make sure that this AddType line is not hidden away inside a         &lt;Virtualhost&gt; or &lt;Directory&gt; block which would         prevent it from applying to the location of your test script.        </span>       </li>       <li class="listitem">        <span class="simpara">         Finally, the default location of the Apache configuration files          changed between Apache 1.2 and Apache 1.3.  You should check to          make sure that the configuration file you are adding the AddType          line to is actually being read. You can put an obvious syntax error         into your <var class="filename">httpd.conf</var> file or some other obvious change that will          tell you if the file is being read correctly.        </span>       </li>      </ul>     </p>    </dd>   </dl>   <dl>    <dt><strong>     <p class="para">      It says to use: <i>--activate-module=src/modules/php4/libphp4.a</i>,       but  that file doesn&#039;t exist, so I changed it to       <i>--activate-module=src/modules/php4/libmodphp4.a</i> and it       doesn&#039;t work!? What&#039;s going on?     </p>    </strong></dt>    <dd><a name="faq.build.activate-module"></a>     <p class="para">      Note that the <var class="filename">libphp4.a</var> file is not supposed to exist.  The      apache process will create it!     </p>    </dd>   </dl>   <dl>    <dt><strong>     <p class="para">      When I try to build Apache with PHP as a static module using       <i>--activate-module=src/modules/php4/libphp4.a</i>       it tells me that my compiler is not ANSI compliant.     </p>    </strong></dt>    <dd><a name="faq.build.ansi"></a>     <p class="para">      This is a misleading error message from Apache that has been fixed      in more recent versions.     </p>    </dd>   </dl>   <dl>    <dt><strong>     <p class="para">      When I try to build PHP using <span class="option">--with-apxs</span> I get strange error messages.     </p>    </strong></dt>    <dd><a name="faq.build.apxs"></a>     <p class="para">      There are three things to check here.  First, for some reason      when Apache builds the apxs Perl script, it sometimes ends up      getting built without the proper compiler and flags variables.      Find your apxs script (try the command <strong class="command">which apxs</strong>),       it&#039;s sometimes found in <var class="filename">/usr/local/apache/bin/apxs</var>      or <var class="filename">/usr/sbin/apxs</var>.      Open it and check for lines similar to these:      <div class="example-contents"><div class="cdata"><pre>my $CFG_CFLAGS_SHLIB  = &#039; &#039;;          # substituted via Makefile.tmplmy $CFG_LD_SHLIB      = &#039; &#039;;          # substituted via Makefile.tmplmy $CFG_LDFLAGS_SHLIB = &#039; &#039;;          # substituted via Makefile.tmpl</pre></div>      </div>      If this is what you see, you have found your problem.  They may       contain just spaces or other incorrect values, such as &#039;q()&#039;.  Change       these lines to say:      <div class="example-contents"><div class="cdata"><pre>my $CFG_CFLAGS_SHLIB  = &#039;-fpic -DSHARED_MODULE&#039;; # substituted via Makefile.tmplmy $CFG_LD_SHLIB      = &#039;gcc&#039;;                   # substituted via Makefile.tmplmy $CFG_LDFLAGS_SHLIB = q(-shared);              # substituted via Makefile.tmpl </pre></div>      </div>      The second possible problem should only be an issue on Red Hat 6.1      and 6.2.  The apxs script Red Hat ships is broken.  Look for this line:      <div class="example-contents"><div class="cdata"><pre>my $CFG_LIBEXECDIR    = &#039;modules&#039;;         # substituted via APACI install</pre></div>      </div>      If you see the above line, change it to this:      <div class="example-contents"><div class="cdata"><pre>my $CFG_LIBEXECDIR    = &#039;/usr/lib/apache&#039;; # substituted via APACI install</pre></div>      </div>       Last, if you reconfigure/reinstall Apache, add a <strong class="command">make clean</strong>        to the process after <strong class="command">./configure</strong> and before <strong class="command">make</strong>.     </p>    </dd>   </dl>   <dl>    <dt><strong>     <p class="para">      During <strong class="command">make</strong>, I get errors in microtime,       and a lot of <i>RUSAGE_</i> stuff.    </p>    </strong></dt>    <dd><a name="faq.build.microtime"></a>     <p class="para">      During the <strong class="command">make</strong> portion of installation,       if you encounter problems that look similar to this:      <div class="example-contents"><div class="cdata"><pre>microtime.c: In function `php_if_getrusage&#039;:microtime.c:94: storage size of `usg&#039; isn&#039;t knownmicrotime.c:97: `RUSAGE_SELF&#039; undeclared (first use in this function)microtime.c:97: (Each undeclared identifier is reported only oncemicrotime.c:97: for each function it appears in.)microtime.c:103: `RUSAGE_CHILDREN&#039; undeclared (first use in this function)make[3]: *** [microtime.lo] Error 1make[3]: Leaving directory `/home/master/php-4.0.1/ext/standard&#039;make[2]: *** [all-recursive] Error 1make[2]: Leaving directory `/home/master/php-4.0.1/ext/standard&#039;make[1]: *** [all-recursive] Error 1make[1]: Leaving directory `/home/master/php-4.0.1/ext&#039;make: *** [all-recursive] Error 1</pre></div>      </div>     </p>     <p class="para">      Your system is broken.  You need to fix your <var class="filename">/usr/include</var> files by      installing a glibc-devel package that matches your glibc.  This has      absolutely nothing to do with PHP.  To prove this to yourself, try this      simple test:     <div class="example-contents"><div class="cdata"><pre>$ cat &gt;test.c &lt;&lt;X#include &lt;sys/resource.h&gt;X$ gcc -E test.c &gt;/dev/null</pre></div>      </div>      If that spews out errors, you know your include files are messed up.      </p>    </dd>   </dl>      <dl>    <dt><strong>     <p class="para">      When compiling PHP with MySQL, configure runs fine but during      <i>make</i> I get an error similar to the following:      <em class="emphasis">ext/mysql/libmysql/my_tempnam.o(.text+0x46): In function       my_tempnam&#039;: /php4/ext/mysql/libmysql/my_tempnam.c:103: the       use of tempnam&#039; is dangerous, better use mkstemp&#039;</em>,       what&#039;s wrong?     </p>    </strong></dt>    <dd><a name="faq.build.mysql.tempnam"></a>     <p class="para">      First, it&#039;s important to realize that this is a <i>      Warning</i> and not a fatal error.  Because this is      often the last output seen during <i>make</i>,      it may seem like a fatal error but it&#039;s not.  Of course, if      you set your compiler to die on Warnings, it will.  Also      keep in mind that MySQL support is enabled by default.     </p>     <blockquote><p><b class="note">Note</b>:              As of PHP 4.3.2, you&#039;ll also see the following text after       the build (make) completes:      <br />             <div class="example-contents"><pre>        Build complete.        (It is safe to ignore warnings about tempnam and tmpnam).       </pre></div>      <br />     </p></blockquote>    </dd>   </dl>      <dl>    <dt><strong>     <p class="para">      I want to upgrade my PHP. Where can I find the <strong class="command">./configure</strong>      line that was used to build my current PHP installation?     </p>    </strong></dt>    <dd><a name="faq.build.upgrade"></a>     <p class="para">      Either you look at config.nice file, in the source tree of your current PHP      installation or, if this is not available, you simply run a       <div class="example-contents"><div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php&nbsp;phpinfo</span><span style="color: #007700">();&nbsp;</span><span style="color: #0000BB">?&gt;</span></span></code></div>      </div>      script. On top of the output the <strong class="command">./configure</strong> line, that was used      to build this PHP installation is shown.     </p>    </dd>   </dl>      <dl>    <dt><strong>     <p class="para">      When building PHP with the GD library it either gives strange compile errors      or segfaults on execution.     </p>    </strong></dt>    <dd><a name="faq.build.gdlibs"></a>     <p class="para">      Make sure your GD library and PHP are linked against the same depending      libraries (e.g. libpng).     </p>    </dd>   </dl>         <dl>    <dt><strong>     <p class="para">      When compiling PHP I seemingly get random errors, like it hangs.      I&#039;m using Solaris if that matters.     </p>    </strong></dt>    <dd><a name="faq.installation.needgnu"></a>     <p class="para">      Using non-GNU utilities while compiling PHP may cause problems.  Be      sure to use GNU tools in order to be certain that compiling PHP will      work.  For example, on Solaris, using either the SunOS BSD-compatible      or Solaris versions of <i>sed</i> will not work, but using      the GNU or Sun POSIX (xpg4) versions of <i>sed</i> will      work.  Links: <a href="http://www.gnu.org/software/sed/sed.html" class="link external">&raquo; GNU sed</a>,      <a href="http://www.gnu.org/software/flex/flex.html" class="link external">&raquo; GNU flex</a>, and      <a href="http://www.gnu.org/software/bison/bison.html" class="link external">&raquo; GNU bison</a>.     </p>    </dd>   </dl>  </div> </div><hr /><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="faq.installation.html">Installation</a></div> <div class="next" style="text-align: right; float: right;"><a href="faq.using.html">Using PHP</a></div> <div class="up"><a href="faq.html">FAQ</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 + -