Home >Backend Development >PHP Tutorial >Compilation Problem_PHP Tutorial

Compilation Problem_PHP Tutorial

WBOY
WBOYOriginal
2016-07-21 16:10:59948browse


This chapter collects many error conditions that may occur during compilation. 1. I used anonymous CVS to get the latest version of the source code package, but there was no configuration script file! 2. I had a problem when configuring PHP to work under Apache. It said it couldn't find httpd.h, but I saw it was there! 3. When I ran conifgure, it said it couldn't find the include file or some library: GD, gdbm, or some other package! 4. I was compiling When trying to file language-parser.tab.c, an error occurred, prompting: yytname undeclared. 5. When I ran make, it worked fine at first but failed in the end. When connecting to the final application, an error occurred saying that some files could not be found. 6. When connecting to PHP, a bunch of errors saying undefined references occurred. 7. I don't know how to compile PHP under Apache 1.3. 8. I installed the Apache module (under Unix) according to the steps step by step, but when I opened the PHP script in the browser, it asked me if I wanted to save it. 9. The system said to use: --activate-module=src/modules/php4/libphp4.a, but the file did not exist at all, so I had to change it to --activate-module=src/modules/php4/libmodphp4.a. , it doesn’t work! What should I do? 10. I want to compile PHP into a static module of Apache, use: --activate-module=src/modules/php4/libphp4.a but the system says that my compiler is not ANSI compatible of. 11. When I compile PHP with --with-apxs, I always get some strange errors. 12. When making, I get a lot of errors about microtime, and a lot of RUSAGE_ stuff. 13. I want to upgrade PHP, where can I see the ./configure line that I used to configure and install the PHP I am running now? Content? 14. When compiling PHP with GD library, it either gives some strange errors or generates segfaults during execution.
1. I used anonymous CVS to get the latest version of the source code package, but there is no configuration script file !
You must install the GNU autoconf package so that the configuration script file can be generated from configure.in. Just run ./buildconf in the top-level directory of the CVS server to get the source code. (Note, unless you run configure with the --enable-maintainer-mode option, the configure script will not be regenerated even if the configure.in file has been updated, so when you find that configure.in has changed, you will have to do it manually. In After running config or config.status, you should see labels like @VARIABLE@ in your Makefile. )
2. I had a problem when configuring PHP to work under Apache. It says it can't find httpd.h, but I see it's there!
You need to tell the configure/setup script the location of Apache's top-level directory. That means you have to specify --with-apache=/path/to/apache, not --with-apache=/path/to/apache/src.
3. When I run conifgure, it says it can't Find the include file or some libraries: GD, gdbm, or some other packages!
You can look at the configure script to see the location of those header files or non-standard libraries. You need to send some special flags to the C preprocessor. For example: CPPFLAGS=-I/path/to/include LDFLAGS=-L/path/to/library ./configure If your shell uses csh-variant, then it will be (why?): env CPPFLAGS=-I/path/to/include LDFLAGS=-L/path/to/library ./configure
4. When I compiled the file language-parser.tab.c, an error occurred, prompting: yytname undeclared.
You need to update your Bison version. You can find the latest version at ftp://ftp.gnu.org/pub/gnu/bison/.
5. When I run make, it works fine at first but eventually fails, When connecting to the final application, an error occurred saying some files could not be found.
Some old versions of make cannot put the compiled files in the functions directory into the same directory. Try running cp *.o functions and then run make to see if it will be better. If so, you really should update your version of GNU Make.
6. When connecting to PHP, a bunch of errors say undefined references.
Look at the link line in the file to confirm that all relevant packages have been included correctly. Usually this is because '-ldl' is missing, and there are some database packages you want to support.
If you are connecting to Apache 1.2.x, do you remember to add some extra information in the EXTRA_LIBS line and rerun Apache's Configure script? See the INSTALL file in the distribution package.
Many people said that they got libphp4.a as soon as they added '-ldl'.
7. I don’t know how to compile PHP under Apache 1.3.
It's actually very simple, follow these steps:

Get the Apache 1.3 source code at the following location: http://www.apache.org/dist/.
Extract it in a directory, such as /usr/local/src/apache-1.3.
In the PHP distribution package directory, compile PHP, ./configure --with-apache=//apache-1.3 (the user’s actual apache-1.3 directory location replaces .
Type: make and then: make install to compile PHP and copy the necessary files to the Apache directory.
Change to your //apache-1.3/src directory and edit the Configuration file. Add the following line to the file: AddModule modules/php4/libphp4.a.
Type: ./Configure and then: make.
This way you have an httpd file!

Note: You can also use the new Apache ./configure script. See README.configure in the distribution package and of course also look at the PHP distribution package. INSTALL file.
8. I installed the Apache module (under Unix) step by step, but when I opened the PHP script in the browser, it asked me if I wanted to save it.
This means your PHP module is not loaded. You can check from the following three points:

Confirm that the Httpd you are running is the Httpd you just compiled PHP. You can run: /path/to/binary/httpd -l
If you don’t see it mod_php4.c is listed, then you are running an incorrect Httpd. It is best to reinstall it.
Make sure you add the correct Mime type in the Apache .conf file. It should look like this: AddType application/x-httpd-php3 .php3 (PHP 3)
or AddType application/x-httpd-php . php (PHP 4)
Also ensure that the AddType line is not included in a or block, which would invalidate it.
Finally, the location of the default configuration file is different between Apache 1.2 and Apache 1.3. You should check the location of the configuration file where you added the AddType line. You can put some obvious errors or changes in httpd.conf so that if If this file is read, the system will notify you.

9. The system said to use: --activate-module=src/modules/php4/libphp4.a, but the file did not exist at all, so I had to change it to --activate-module=src/modules/php4 /libmodphp4.a Ok, it doesn’t work! What to do?
Please note that libphp4.a does not exist. The apache process will create it!
10. I want to compile PHP into a static module for Apache , use: --activate-module=src/modules/php4/libphp4.a but the system says that my compiler is not ANSI compatible.
This error message is misleading by Apache and can be fixed with a newer version.
11. When I compile PHP with --with-apxs, I always get some strange errors.
When this happens, you can check from three points. First, for some reason, Apache did not create the appropriate flag variable when compiling the apxs Perl script. Find your apxs script (try the command which apxs , usually in /usr/local/apache/bin/apxs or /usr/sbin/apxs. Open it and find a line like the following: my $CFG_CFLAGS_SHLIB = ' '; ; # substituted via Makefile.tmplmy $CFG_LD_SHLIB = ' '; in Here. Because the value contains spaces or other incorrect values, such as 'q()'. Change it to like the following: my $CFG_CFLAGS_SHLIB = '-fpic -DSHARED_MODULE'; # substituted via Makefile.tmplmy $CFG_LD_SHLIB = 'gcc'; # substituted via Makefile.tmpl The second possibility is just Appears on Red Hat 6.1 and 6.2. The apxs script Red Hat version has an error. Look at this line: my $CFG_LIBEXECDIR = 'modules'; # substituted via APACI install If you see it, change it to the following line: my $CFG_LIBEXECDIR = '/usr/lib/apache'; # substituted via APACI install Third, if you reconfigure/reinstall Apache, you must execute make clean
12. after ./configure and before make. When making, I get a lot of errors about microtime, and a lot of RUSAGE_ stuff.
When making during the installation process, if you see the following error: microtime.c: In function `php_if_getrusage':microtime.c:94: storage size of `usg' isn't knownmicrotime.c:97: `RUSAGE_SELF' 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' undeclared (first use in this function)make[3]: *** [microtime.lo] Error 1make[3]: Leaving directory `/home/master/php-4.0.1/ext/standard'make[2]: *** [all-recursive] Error 1make[2]: Leaving directory `/home/master/ php-4.0.1/ext/standard'make[1]: *** [all-recursive] Error 1make[1]: Leaving directory `/home/master/php-4.0.1/ext'make: *** [all-recursive] Error 1
That is an error on your system. You should repair the /usr/include file. The specific method is to install the glibc-devel package that matches your glibc. These errors have nothing to do with PHP. Proof, you can do this: $ cat >test.c << >13. I want to upgrade PHP. Where can I see the content of the ./configure line that I used to configure and install the PHP I am running now?
You can look at the config in the source directory where you installed PHP. nice file. If that doesn't work there is another way. You can simply run Script. The first line on the output page is the ./configure line, which is the line you used to configure PHP.
14. When compiling PHP with the GD library , it either gives some strange errors, or generates segfaults during execution.
You must confirm that you use the same dependent library (such as libpng) when compiling the GD library and PHP.

http://www.bkjia.com/PHPjc/314067.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/314067.htmlTechArticleThis chapter collects many error situations that may occur during compilation. 1. I used anonymous CVS to get the latest version of the source code package, but there was no configuration script file! 2. When I configured PHP to work under Apache...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn