Compiling and installing Apache and php on aix 1 Revision control



Download 37.26 Kb.
Date29.07.2017
Size37.26 Kb.
#24217
Compiling and installing Apache and PHP on AIX 6.1
Revision control


Date

Version

Author

Description

21/02/2010

-

Peter Farrell

Initial version

23/02/2010

V2

Peter Farrell

Re-execute steps on a clean system to identify the minimal steps required.

A customer wanted to run Apache and PHP on their AIX 6.1 system. They quickly discovered that the versions in the AIX Linux Toolbox are outdated and some do not run on AIX 6.1. Following a little investigation, I determined that the customer was correct and decided to investigate exactly what was required to install and run the latest versions of Apache and PHP.


I started by following the instructions at the website

http://www.ibm.com/developerworks/wikis/display/wikiptype/aixopen

up to the point where the author describes "Compiling PHP on AIX".
Compilation
I needed to compile a number of packages. I downloaded the GCC compiler and its library (specifically the 6.1 version) from the Linux Toolbox website in RPM format and installed them. I also downloaded GNU make.
Apache
I downloaded httpd-2.2.14 from the Apache website. This is a later version than the precompiled versions available.
echo $PATH

/usr/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin:/usr/java5/jre/bin:/usr/java5/bin:/opt/freeware/bin


Note, this will use AIX make. You can also use GNU make.
./configure -C --enable-so --prefix /usr/local/apache2 \

--with-included-apr

make

make install


Edited I edited the configuration file (httpd.conf) to change the User and Group names from daemon to nobody.
This configuration and compilation of Apache was successful and I was able to connect to the Web server. However, this configuration and compilation subsequently did not support the APR functions required by PHP. Note that this configuration did include the built in APR functions.
PHP
Attempting to build PHP using the defaults (and most of the configuration options below) results in an issue where configure does not recognise that AIX supports shared libraries.
In fact, many of the packages that PHP depends on also require modification so that they can build shared libraries. Finally, some of the precompiled packages in the AIX toolbox are compiled against AIX 5.1 and so I decided to rebuild these against AIX 6.1.
Libtool

This step is not required.

I think that the version in the AIX toolbox is built against AIX 5.1


Download latest source version of libtool (2.2.6b). http://ftp.gnu.org/gnu/libtool/

./configure --prefix=/opt/freeware

make

make install


Libxml2
The AIX Linux toolbox contains version 2.6.21-2 and 2.6.21-4. It would appear that the "-2" version does not support shared libraries.

I needed to rebuild this package to support shared libraries.


Download source code for libxml: http://xmlsoft.org/sources/old/libxml2-2.6.30.tar.gz

(see also http://bitsex.net/software/2008/php-compile-error-warning-inter-library-dependencies-are-not-known-to-be-supported/).


Note that there are later versions (e.g. 2.7.6) but I was not able to get these to compile.
(see also http://bitsex.net/software/2008/php-compile-error-warning-inter-library-dependencies-are-not-known-to-be-supported/).
Edit configure to cope with AIX6. (1,$s/aix5\*/aix5* |aix6* /)
Change PATH to point to /usr/bin ahead of /opt/freeware/bin
configure --prefix=/opt/freeware \

--without-threads \

--host=powerpc-ibm-aix6.1.4.0

make


make install.
binutils

This step is not required.

Download source code for binutils-2.20 on the grounds that the version in the toolbox appears to be built for AIX 5.1.

http://ftp.gnu.org/gnu/binutils/


./configure --target=powerpc-ibm-aix6.1.4.0 --prefix=/opt/freeware

make (and wait until this fails!)


There appears to be some issue with whether configure can properly identify whether AIX has a function to generate a temporary directory. I managed to work around it by patching configure as follows.
#cd binutils

# diff configure configure.dist

12539c12539

< #if test "x$ac_cv_func_mkstemp" = x""yes; then :

---


> if test "x$ac_cv_func_mkstemp" = x""yes; then :

12541,12542c12541



< #$as_echo "#define HAVE_MKSTEMP 1" >>confdefs.h

< $as_echo "#undef HAVE_MKSTEMP" >>confdefs.h

---


> $as_echo "#define HAVE_MKSTEMP 1" >>confdefs.h

12544c12543



< #fi

---


> fi

12546,12547c12545,12546



< #ac_fn_c_check_func "$LINENO" "mkdtemp" "ac_cv_func_mkdtemp"

< #if test "x$ac_cv_func_mkdtemp" = x""yes; then :

---


> ac_fn_c_check_func "$LINENO" "mkdtemp" "ac_cv_func_mkdtemp"

> if test "x$ac_cv_func_mkdtemp" = x""yes; then :

12549,12550c12548

< #$as_echo "#define HAVE_MKDTEMP 1" >>confdefs.h

< $as_echo "#undef HAVE_MKDTEMP" >>confdefs.h

---


> $as_echo "#define HAVE_MKDTEMP 1" >>confdefs.h

12552c12550



< #fi

---


> fi
# vi configure.patch

Copy the diff from above into configure.patch

#cp configure configure.dist

#patch -R -i configure.patch configure

(run grep MKDTEMP configure and check that the variable is undefined. If it is not, try the patch command without -R)

./configure --prefix=/opt/freeware \

--target=powerpc-ibm-aix6.1.4.0 \

--disable-largefile \

2>&1|tee configure.log
cd ..

cd ld


./configure --disable-largefile --prefix=/opt/freeware --target=powerpc-ibm-aix6.1.4.0

cd ..


./configure --target=powerpc-ibm-aix6.1.4.0

make 2>&1 |tee make.log


You may need to run make several times returning to the subdirectories to rerun configure. I don't understand why.
PHP 5.3
Download and unpack the source code for php from

http://www.php.net/downloads.php

I chose the complete source code version 5.3.1
Edit ./configure to work with AIX 6.1 (assuming vi, :1,$s/aix5\*/aix5* | aix6*/ )

export PATH=/opt/freeware/bin:$PATH

You will need to use GNU make to compile PHP. Change $PATH to pick up GNU make ahead of AIX make.

rpm -Uvh make-3.80-1.aix5.1.ppc.rpm

export PATH=/opt/freeware/bin:$PATH
Note that the original $PATH at this point should be the value from a normal login, ie something like /bin:/usr/bin: etc.
Otherwise the compilation will fail with a message like:
Generating phar.php

/bin/sh[14]: -d: not found


Edit ./configure to work with AIX 6.1 (assuming vi, :1,$s/aix5\*/aix5* | aix6*/ )

Note, without the option

--host=powerpc-ibm-aix6.1.4.0

configure does not know how to build shared libraries and this is fatal.


I attempted to use the configuration parameters requested by the customer:
./configure --prefix=/usr/local \

--host=powerpc-ibm-aix6.1.4.0 \

--with-apxs2=/usr/local/apache2/bin/apxs \

--with-config-file-path=/usr/local/apache2/conf --with-gd \

--with-zlib-dir=/opt/freeware/lib \

--enable-shared \

--with-png \

--with-zlib \

--with-bz2 \

--with-xml \

--with-freetype-dir=/opt/freeware/lib \

--with-jpeg-dir=/opt/freeware/lib/ \

--with-png-dir=/opt/freeware/lib/ \

--with-xpm-dir=/opt/freeware/lib/ \

--with-freetype-dir=/opt/freeware/lib/ \

2>&1 |tee configure.log


This reported the following message:
Notice: Following unknown configure options were used:
--with-png

--with-xml


Check './configure --help' for available options
It would appear that these options deprecated. The solution to the above problem appears to be to add the lines

--with-png-dir=/opt/freeware/lib/ \

--with-libxml-dir=/opt/freeware \
and to remove the two offending lines.
line

--with-xml


There appears to be another problem with the config.h file below. This is a knowing PHP bug. Even though on AIX the file /usr/include/arpa/nameser_compat.h exists, there is a problem with this #define which causes compilations to fail.
The proper fix is to edit ./ext/standard/dns.c. This should fix the problem during the configure phase. If you want to do this, you can refer to the PHP bug site.
However, I edited the file to remove the #define as follows.

Edit the file ./main/php_config.h and change

#define HAVE_ARPA_NAMESER_COMPAT_H 1

to


#define HAVE_ARPA_NAMESER_COMPAT_H 0

The make ended with an error (-D initial script)

rebuilt and installed libtools and binutils

THE MAKE COMPILATION ENDED WITH AN ERROR IN A SHELL SCRIPT


The make command complete successfully, generating shared libraries in .libs. (Note that make install does not work). These shared libraries need to be copied over to the Apache directories manually and the Apache configuration file needs to be modified. This is described in the website http://www.ibm.com/developerworks/wikis/display/wikiptype/aixopen
The next problem encountered occurred when starting Apache. Apache reported that there were symbols in the libphp5.so library which could not be satisfied on loading. The symbols were associated with the APR package h despite the fact that owever building Apache had been built with the option --with-included-apr did not seem to relieve this problem.
Therefore, instead of using the internal APR functions I downloaded the external packages from the Apache website.
APR and APR-utils
Download the source code from the Apache website

For APR:


./configure --prefix=/opt/freeware --host=powerpc-ibm-aix6.1.4.0

make


make install
For APR-utils:

./configure --prefix=/opt/freeware \

--with-apr=/opt/freeware \

--host=powerpc-ibm-aix6.1.4.0

make

make install


Finally, I rebuilt the Apache Web server:
./configure -C --enable-so --prefix=/usr/local/apache2 \

--with-apr=/opt/freeware \

--with-apr-util=/opt/freeware \

2>&1 |tee configure.log



make

make install


I was then able to successfully start the Web server and access the phpinfo.php page that I had created!

Download 37.26 Kb.

Share with your friends:




The database is protected by copyright ©ininet.org 2024
send message

    Main page