📄 faq.build.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head> <title>Build Problems</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> </head> <body><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><hr /><div> <h1>Build Problems</h1> <p class="para"> This section gathers most common errors that occur at build time. </p> <div class="qandaset"><ol class="qandaset_questions"><li><a href="#faq.build.configure"> I got the latest version of PHP using the anonymous CVS service, but there's no configure script! </a></li><li><a href="#faq.build.configuring"> I'm having problems configuring PHP to work with Apache. It says it can't find httpd.h, but it's right where I said it is! </a></li><li><a href="#faq.build.lex"> While configuring PHP (./configure), you come across an error similar to the following: checking lex output file root... ./configure: lex: command not found configure: error: cannot find output from lex; giving up </a></li><li><a href="#faq.build.apache-sharedcore"> When I try to start Apache, I get the following message: fatal: relocation error: file /path/to/libphp4.so: symbol ap_block_alarms: referenced symbol not found </a></li><li><a href="#faq.build.not-found"> When I run configure, it says that it can't find the include files or library for GD, gdbm, or some other package! </a></li><li><a href="#faq.build.yytname"> When it is compiling the file language-parser.tab.c, it gives me errors that say yytname undeclared. </a></li><li><a href="#faq.build.link"> When I run make, it seems to run fine but then fails when it tries to link the final application complaining that it can't find some files. </a></li><li><a href="#faq.build.undefined"> When linking PHP, it complains about a number of undefined references. </a></li><li><a href="#faq.build.Apache"> I can't figure out how to build PHP with Apache 1.3. </a></li><li><a href="#faq.build.not-running"> 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. </a></li><li><a href="#faq.build.activate-module"> It says to use: --activate-module=src/modules/php4/libphp4.a, but that file doesn't exist, so I changed it to --activate-module=src/modules/php4/libmodphp4.a and it doesn't work!? What's going on? </a></li><li><a href="#faq.build.ansi"> When I try to build Apache with PHP as a static module using --activate-module=src/modules/php4/libphp4.a it tells me that my compiler is not ANSI compliant. </a></li><li><a href="#faq.build.apxs"> When I try to build PHP using --with-apxs I get strange error messages. </a></li><li><a href="#faq.build.microtime"> During make, I get errors in microtime, and a lot of RUSAGE_ stuff. </a></li><li><a href="#faq.build.mysql.tempnam"> When compiling PHP with MySQL, configure runs fine but during make I get an error similar to the following: ext/mysql/libmysql/my_tempnam.o(.text+0x46): In function my_tempnam': /php4/ext/mysql/libmysql/my_tempnam.c:103: the use of tempnam' is dangerous, better use mkstemp', what's wrong? </a></li><li><a href="#faq.build.upgrade"> I want to upgrade my PHP. Where can I find the ./configure line that was used to build my current PHP installation? </a></li><li><a href="#faq.build.gdlibs"> When building PHP with the GD library it either gives strange compile errors or segfaults on execution. </a></li><li><a href="#faq.installation.needgnu"> When compiling PHP I seemingly get random errors, like it hangs. I'm using Solaris if that matters. </a></li></ol> <dl> <dt><strong> <p class="para"> I got the latest version of PHP using the anonymous CVS service, but there's no configure script! </p> </strong></dt> <dd><a name="faq.build.configure"></a> <p class="para"> You have to have the GNU autoconf package installed so you can generate the configure script from <var class="filename">configure.in</var>. Just run <strong class="command">./buildconf</strong> in the top-level directory after getting the sources from the CVS server. (Also, unless you run configure with the <i>--enable-maintainer-mode</i> option, the configure script will not automatically get rebuilt when the <var class="filename">configure.in</var> file is updated, so you should make sure to do that manually when you notice configure.in has changed. One symptom of this is finding things like @VARIABLE@ in your Makefile after configure or <var class="filename">config.status</var> is run.) </p> </dd> </dl> <dl> <dt><strong> <p class="para"> I'm having problems configuring PHP to work with Apache. It says it can't find <var class="filename">httpd.h</var>, but it's right where I said it is! </p> </strong></dt> <dd><a name="faq.build.configuring"></a> <p class="para"> You need to tell the configure/setup script the location of the top-level of your Apache source tree. This means that you want to specify <span class="option">--with-apache=/path/to/apache</span> and <em class="emphasis">not</em> <span class="option">--with-apache=/path/to/apache/src</span>. </p> </dd> </dl> <dl> <dt><strong> <p class="para"> While configuring PHP (<i>./configure</i>), you come across an error similar to the following: </p> <p class="para"> <div class="example-contents"><pre> checking lex output file root... ./configure: lex: command not found configure: error: cannot find output from lex; giving up </pre></div> </p> </strong></dt> <dd><a name="faq.build.lex"></a> <p class="para"> Be sure to read the <a href="install.unix.html" class="link">installation</a> instructions carefully and note that you need both flex and bison installed to compile PHP. Depending on your setup you will install bison and flex from either source or a package, such as a RPM. </p> </dd> </dl> <dl> <dt><strong> <p class="para"> When I try to start Apache, I get the following message: </p> <p class="para"> <div class="example-contents"><pre> fatal: relocation error: file /path/to/libphp4.so: symbol ap_block_alarms: referenced symbol not found </pre></div> </p> </strong></dt> <dd><a name="faq.build.apache-sharedcore"></a> <p class="para"> This error usually comes up when one compiles the Apache core program as a DSO library for shared usage. Try to reconfigure apache, making sure to use at least the following flags: </p> <p class="para"> <div class="example-contents"><pre> --enable-shared=max --enable-rule=SHARED_CORE </pre></div> </p> <p class="para"> For more information, read the top-level Apache <var class="filename">INSTALL</var> file or the Apache <a href="http://httpd.apache.org/docs/1.3/dso.html" class="link external">» DSO manual page</a>. </p> </dd> </dl> <dl> <dt><strong> <p class="para"> When I run configure, it says that it can't find the include files or library for GD, gdbm, or some other package! </p> </strong></dt> <dd><a name="faq.build.not-found"></a> <p class="para"> You can make the configure script looks for header files and libraries in non-standard locations by specifying additional flags to pass to the C preprocessor and linker, such as: <div class="example-contents"><div class="cdata"><pre> CPPFLAGS=-I/path/to/include LDFLAGS=-L/path/to/library ./configure</pre></div> </div> If you're using a csh-variant for your login shell (why?), it would be: <div class="example-contents"><div class="cdata"><pre> env CPPFLAGS=-I/path/to/include LDFLAGS=-L/path/to/library ./configure</pre></div> </div> </p> </dd> </dl> <dl> <dt><strong> <p class="para"> When it is compiling the file <var class="filename">language-parser.tab.c</var>, it gives me errors that say <i>yytname undeclared</i>. </p> </strong></dt> <dd><a name="faq.build.yytname"></a> <p class="para"> You need to update your version of Bison. You can find the latest version at <a href="http://www.gnu.org/software/bison/bison.html" class="link external">» http://www.gnu.org/software/bison/bison.html</a>. </p> </dd> </dl> <dl> <dt><strong> <p class="para"> When I run <strong class="command">make</strong>, it seems to run fine but then fails when it tries to link the final application complaining that it can't find some files. </p> </strong></dt> <dd><a name="faq.build.link"></a> <p class="para"> Some old versions of make that don't correctly put the compiled versions of the files in the functions directory into that same directory. Try running <strong class="command">cp *.o functions</strong> and then re-running <strong class="command">make</strong> to see if that helps. If it does, you should really upgrade to a recent version of GNU make. </p> </dd> </dl> <dl> <dt><strong> <p class="para"> When linking PHP, it complains about a number of undefined references. </p> </strong></dt> <dd><a name="faq.build.undefined"></a> <p class="para"> Take a look at the link line and make sure that all of the appropriate libraries are being included at the end. Common ones that you might have missed are '-ldl' and any libraries required for any database support you included. </p> <p class="para"> If you're linking with Apache 1.2.x, did you remember to add the appropriate information to the EXTRA_LIBS line of the Configuration file and re-rerun Apache's Configure script? See the <a href="install.html" class="link">installation chapter</a> for more information. </p> <p class="para"> Some people have also reported that they had to add '-ldl' immediately following <var class="filename">libphp4.a</var> when linking with Apache. </p> </dd> </dl> <dl> <dt><strong> <p class="para"> I can't figure out how to build PHP with Apache 1.3. </p> </strong></dt> <dd><a name="faq.build.Apache"></a> <p class="para"> This is actually quite easy. Follow these steps carefully: <ul class="itemizedlist"> <li class="listitem"> <span class="simpara"> Grab the latest Apache 1.3 distribution from <a href="http://www.apache.org/dist/httpd/" class="link external">» http://www.apache.org/dist/httpd/</a>. </span> </li> <li class="listitem"> <span class="simpara"> Ungzip and untar it somewhere, for example <var class="filename">/usr/local/src/apache-1.3</var>. </span> </li> <li class="listitem"> <span class="simpara">
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -