Home >Backend Development >PHP Tutorial >PHP compilation problems_PHP tutorial
1. I used anonymous CVS to get the latest version of the source code package, but there is no configuration script file! 4. When I compiled the file language-parser.tab.c, an error occurred, prompting: yytname undeclared. 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=/ Type: make and then: make install to compile PHP and copy the necessary files to the Apache directory. Change to your / Type: ./ Configure then: make. So you have an httpd file! Note: You can also use the new Apache ./configure script. See the README in the distribution package. Of course, configure also needs to look at the INSTALL file in the PHP distribution package. Confirm that the Httpd you are running is the Httpd you just compiled PHP. You can run: / path/to/binary/httpd -l Make sure you are in Apache .conf. The correct Mime type has been added to the file. It should look like this: AddType application/x-httpd-php3 .php3 (PHP 3) 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? That is an error in your system. You should repair the /usr/include file. The specific method is to install the one that matches your glibc glibc-devel package. These errors have absolutely nothing to do with PHP. To prove it, you can do this: $ cat >test.c X$ gcc -E test.c >/dev/null
You must install the GNU autoconf package so that the configuration script file can be generated from configure.in. Just run The CVS server gets ./buildconf in the top-level directory of 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
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 the steps below:
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 that your PHP module has not been loaded. You can check from the following three points:
If you don't see mod_php4.c listed, then you are running incorrect Httpd. Best to reinstall it
or AddType application/x-httpd-php .php (PHP 4)
also Make sure that the AddType line is not included in a
Please note that libphp4.a does not actually 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 = ' '; # substituted via Makefile.tmplmy $CFG_LDFLAGS_SHLIB = ' '; # substituted via Makefile.tmpl
If you see this, then the problem lies here. Because the value contains spaces or other incorrect values, such as 'q()'. Change it to something like this: my $CFG_CFLAGS_SHLIB = '-fpic -DSHARED_MODULE'; # substituted via Makefile.tmplmy $CFG_LD_SHLIB = 'gcc'; # substituted via Makefile.tmplmy $CFG_LDFLAGS_SHLIB = q (-shared); # substituted via Makefile.tmpl
The second possibility only appears on Red Hat 6.1 and 6.2. The Red Hat version of the apxs script is wrong. 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/reset To install Apache, you must execute make clean after ./configure and before make.
12. When making, I get a lot of microtime errors 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
If there is an error, prove you The include file is damaged.
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 see You install the config.nice file in the PHP source directory. If that doesn't work, there is another way. You just need to simply run the
script. The first line on the output page is the ./configure line, which is where you originally The line 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 are compiling the GD library and PHP The same dependent library (such as libpng) is used.