LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   PHP4 & Apache Install Error (https://www.linuxquestions.org/questions/programming-9/php4-and-apache-install-error-5395/)

yazan 08-13-2001 06:40 PM

PHP4 & Apache Install Error
 
Hi all,

Okay here is the error message I am getting when I try to start apache server after installing php4:

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

Here is what I did from the start:

1. untared apache_1.3.20.tar.gz
2. ./configure --enable-module=most --enable-shared=max
3. make
4. make install

That installed the server with no problems and with support for DSO

Next trying to install php4

1. again untarring php4
2. ./configure --with-mysql=/usr/local/mysql --with-apxs=/usr/local/apache/bin/apxs
3. make
4. make install

Everything runs okay and everything installs properly.

Then :

1. copy the php.ini-dist file to the apache conf file and name it php.ini
2. checking httpd.conf for the following :

LoadModule php4_module libexec/libphp4.so
AddModule mod_php4.c

AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

Upon restarting the server the above error appears saying libphp4.so: undefined symbol: uncompress

Does anyone have any idea what is going on?
I have looked everywhere for an answer and came up blank. Would really appreciate any direction.

Extra info:
1. Distro Red Hat Linux 6.2
2. PHP 4.0.6
3. Apache 1.3.20

Thanks,
Yazan

yazan 08-13-2001 11:35 PM

Re: PHP4 & Apache Install Error
 
Okay with a little determination I found the answer to my problem and thought I would post it on here since I found plenty of lists and forums that had the question but not the answer so here it goes:

The problem with the "uncompress" symbol is related to libz.so.#
This is a DSO library which is required when building PHP4.

So here is the error message again:
Cannot load /usr/local/apache/libexec/libphp4.so: /usr/local/apache/libexec/libphp4.so: undefined symbol: uncompress

Now here is the solution:

1. First try to clean out whatever files and directories you have created while building php4. Usually they are all under the php#.#.# directory created when you untar the zipped package.
What I did is run the following under the php directory:
>make clean
>make clean all
>cd ..
>rm -Rf php_4.0.6 (note: version numbers may vary)

2. I manually removed libphp4.so from the apache/libexec directory


3. Obviously I had to re-untar the php package
>tar -zxvf php_4.0.6.tar.gz

4. I ran the configure command
>./configure --with-apxs=/usr/local/apache/bin/apxs --with-mysql=/usr/local/mysql --without-zlib

(Here is what "solves" the problem)
5. Now *BEFORE* running "make" find the top level "Makefile" in the php directory. Using your favourite editor look for the following line:

LTLIBRARY_LDFLAGS = [ other options already there ]

add to it the three characters -lz which are not included by default.

so now it looks like :

LTLIBRARY_LDFLAGS = -lz [ other options already there ]

6. Save and exit.

7. You can now run "make" and then "make install"

To make sure that libz.so.# has been properly linked to libphp4.so run the following command from the apache directory:

>ldd libexec/libphp4.so
libz.so.1 => /usr/lib/libz.so.1 (0x40129000) libpam.so.0 => /lib/libpam.so.0 (0x40138000)
libdl.so.2 => /lib/libdl.so.2 (0x40140000)
libgd.so.1 => /usr/lib/libgd.so.1 (0x40143000)
libresolv.so.2 => /lib/libresolv.so.2 (0x40179000)
libm.so.6 => /lib/libm.so.6 (0x40188000)
libcrypt.so.1 => /lib/libcrypt.so.1 (0x401a5000)
libnsl.so.1 => /lib/libnsl.so.1 (0x401d2000)
libc.so.6 => /lib/libc.so.6 (0x401e8000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000)

(notice the first line in the result!)

Once everything has finished compiling and installing don't forget to edit the httpd.conf file to reflect the php extension by adding the following lines:

AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

and making sure that the following lines are there and pointing to the correct files and directories:

LoadModule php4_module libexec/libphp4.so
AddModule mod_php4.c

finally copy php.ini-dist to the apache/conf folder and rename it to php.ini

8. Start the apache server and everything should be fine:
>apache/bin/apachectl start
bin/apachectl start: httpd started

That means that the apache server started with the php module with no problems.
To test that PHP really works I created the following page:

<HTML>
<HEAD><TITLE> PHP Test </TITLE></HEAD>
<BODY>
<?php phpinfo( ); ?>
</BODY>
</HTML>

Save this file in your htdocs directory as test.php and then test it on your browser using:
http://localhost/test.php as the address, you should see the PHP Page with its current configuration.

Hope this helps others out there...

-yazan

indy_bob 02-28-2002 03:02 PM

Just wanted to post that I had the same exact problem which I could not figure out. The previously posted steps worked perfectly.

Configuration:

Distro - Slackware 8
Apache 1.3.23
PHP 4.1.1
MySql 3.23.49a

Many thanks.


All times are GMT -5. The time now is 01:44 AM.