Hi all 🙂

I'm trying to install php 4.0.3pl1 on my RedHat Linux 6.2 box (2.2.14-5.0 kernel) and have been having some problems. I have downloaded apache 1.3.14 and have been trying for awhile now to compile apache with php4 module support (I also want mysql support for the php module).

PHP compiles fine - I used

./configure --with-mysql=/usr/local/mysql --with-apache=../apache_1.3.14
make
make install

but when I try to compile apache (using
./configure \
"--with-layout=Apache" \
"--prefix=/usr/local/apache" \
"--enable-rule=SHARED_CORE" \
"--with-apxs=/usr/sbin/apxs" \
"--add-module=/src/modules/standard/mod_so.c" \
... etc (other standard modules)
"--add-module=/src/modules/php4/mod_php4.c" \
"$@"

) it fails when it gets to the php4 module (other modules work fine) with:

mod_php4.c:28: zend.h: No such file or directory
mod_php4.c:29: php.h: No such file or directory
mod_php4.c:30: php_variables.h: No such file or directory
mod_php4.c:47: php_ini.h: No such file or directory
mod_php4.c:48: php_globals.h: No such file or directory
mod_php4.c:49: SAPI.h: No such file or directory
mod_php4.c:50: php_main.h: No such file or directory
mod_php4.c:52: zend_compile.h: No such file or directory
mod_php4.c:53: zend_execute.h: No such file or directory
mod_php4.c:54: zend_highlight.h: No such file or directory
mod_php4.c:55: zend_indent.h: No such file or directory
mod_php4.c:57: ext/standard/php_standard.h: No such file or directory
mod_php4.c:61: mod_php4.h: No such file or directory
make[4]: [mod_php4.o] Error 1
make[3]:
[all] Error 1
make[2]: *** [subdirs] Error 1

I though that PHP would put all the files in the right place for apache to compile, but I am obviously doing something wrong - I just can't see what.

I have been searching the net but most PHP stuff I have found has not mentioned recompiling apache, or anything like that. I'm not even sure if I'm using the right method but I wanted to use DSO support.

Any help would be greatly appreciated.

  • Nick Lane

    You're going about it the long way. Try this:

    for apache, do this:

    ./configure --prefix=/www \
    --enable-module=most \
    --enable-shared=max

    you can edit modules you don't want out of the httpd.conf later.

    You may need to delete/rename your httpd.conf file so that the new one will get written out.

    make install apache, then build php like this:

    ./configure --with-apxs=/www/bin/apxs
    make ; make install

    And that should be all you need to do. don't forget to add your own switches to the php ./configure script.

      Thanks for the help Scott, I managed to get everything to compile ok - but now when I try to start apache I get the following message:

      Syntax error on line 207 of /usr/local/apache/conf/httpd.conf: Cannot load /usr/local/apache/libexec/libphp4.so into server: /usr/local/apache/
      libexec/libphp4.so: undefined symbol: uncompress

      Does this mean I don't have the required libraries to get php to run? If so is there a list of dependencies anywhere? I'm faily new to unix so forgive me if this is a stupid question 🙂

        You've got me. I run redhat 6.2 with apache 1.3.14 and php 4.0.3pl1, so it should work. Were you usig any other switches for php?

          I configured php with the following:

          ./configure \
          --with-apxs=/usr/local/apache/bin/apxs \
          --with-mysql=/usr/local/mysql

          where /usr/local/mysql is the path to mysql, and /usr/local/apache is the path to apache 1.3.14

            I think I've found the problem:

            /usr/local/mysql/lib/libmysqlclient.a(my_compress.o): In function my_uncompress
            ':
            my_compress.o(.text+0x97): undefined reference to
            uncompress'
            /usr/local/mysql/lib/libmysqlclient.a(my_compress.o): In function my_compress_a
            lloc':
            my_compress.o(.text+0x12b): undefined reference to
            compress'

            It seems the problem lies with mysql. I have looked at the mysql docs but I couldn't find anything.

              Check to see if this rpm is installed (your version number may be different) and install it if not:

              ncompress-4.2.4-14

                I have it installed (version 4.2.4-15)

                rpm -q ncompress
                ncompress-4.2.4-15

                Well maybe I could try a fresh RedHat install then...

                That's the only thing I can think of, as I have spoken to others who haven't had any problems.

                Thanks for your help

                • nick
                  a month later

                  Cool... just pushing it here, but I notice if you break up the install paths, the make on apache errors out.
                  The Scenario:
                  I cd'd into apache-src/ and "./configure" then cd'd into the php-src "./configure" , "make" then "make install" PHP4. It installed OK, no errors. I configured it as a static module.
                  I cd'd back into apache-src and then re-ran "./configure" this time i broke up the install paths, this is the exact commands i used "./configure --prefix=/usr --sysconfdir=/etc/httpd/conf --datadir=/public_html --localstatedir=/var --activate-module=src/modules/php4/libmodphp4.a." It configures ok but when i "make" it errors out when it hits the libmodphp4.a with "can't find php?.h file references" but if i just do a "./configure --activate-module=src/modules/php4/libmodphp4.a" it works ok.... but any change other than defualt path i notice will not work. Any clues what I'm not doing or doing wrong?

                  Thanks

                    2 months later

                    Hello,

                    I encountered the same issue (compress reference not found in mysql related objects) and I found the following solution.

                    Once you are ready to make Apache (the operation that fails), you have to edit the apache-1.3.x/src/Makefile file. You will find a line beginning with :

                    LDFLAGS=$(...

                    Append -lz' (for RedHat 6.2) or-lgz' (recommanded by mysql.com) to this line :

                    LDFLAGS=$(... -lz

                    Where you are done, go back to apache-1.3.x and make Apache :

                    make
                    make install

                    It is magic : it works (for me at least ;-) ! I hope this will help.

                    Francis Pallini
                    hefpe@classeweb.com

                      13 days later

                      I'm trying to perform this install on Mandrake 7.2. When I append -lz or -lgz to the LDFLAGS line, I get the error message "/usr/bin/ld: cannot find -lz (or -lgz)". Has anyone figured out a workaround for Madrake users?

                        10 months later

                        I've had this problem.
                        Start over from scratch (untar the source again).
                        Configure Apache FIRST.
                        Then configure PHP.
                        Then configure Apache AGAIN.

                          Write a Reply...