Compiling Apache2 and PHP5 on AIX 5.3 TL5
I’ve been working on my test AIX 5.3 system trying to get Apache2 and PHP installed. My ultimate goal is too get Apache2 and PHP setup
so I can install Drupal and start testing it with a DB2 back end. If I can get it working and running stable, I will move all of my test web sites over to this machine.
After some trial and error, here is how I got Apache2 and PHP5 compiled on my AIX 5.3 TL5 machine.
Prerequisites
1. Make sure you have plenty of free space in the following filesystems.
/usr /opt /home /tmp
2. Download the latest code available.
- Apache Web Server 2.2.2 source code – link
- GNU C compiler version 4 for AIX 5.3 – link
- GCC library for AIX 5.3 – link
- PHP 5.1 source code – link
- XML support – IBM’s AIX Toolbox for Linux Applications is back rev’d. Use these instead
libxml2 2.6.21 libxml2-devel
General tools from IBM AIX Toolbox Download Page
- LEX flex-2.5
- XML support expat-1.95.7
- Compression library zlib-1.2.2
- Compression develoment zlib-devel-1.2.2
- Compression library bz2-1.0.2-3
- jpeg support libjpeg-6b-6
- jpeg support development libjpeg-devel-6b-6
- png support libpng-1.2.1-6
- png development libpng-devel-1.2.1-6
- Pixmap xpm-3.4k
- Pixmap development xpm-devel-3.4k
- Freetype2 fonts freetype2-2.1.7-2
- Freetype2 fonts development freetype2-devel-2.1.7-2
- Gettext support gettext-0.10.40
- Any other libraries you might need for Apache or PHP
Install all the RPM files
3. Install libm.a from the AIX CDROM
4. Install the compiler and library
rpm -Uvh gcc-4*.rpm rpm -Uvh libgcc-4*rpm
5. Make sure you’re running AIX 5.3 TL5. They are reported the following steps don’t work on anything earlier than that.
Compiling Apache2 using GCC
1. Uncompress the Apache Web Server source into your home directory
# gunzip httpd-2*tar.gz
# tar xvf httpd-2*.tar
# cd httpd*
2. Build the configuration file enabling shared object
# ./configure
3. Compile the server
# slibclean
# make
4. Install the server (/usr/local/apache2)
# make install
Compiling PHP using GCC
1. Uncompress the PHP source code file and untar the file
# gunzip php*tar.gz
# tar xvf php*.tar
# cd php-5.1.4
2. Build the configuration file enabling shared objects
# export PATH=/opt/freeware/bin:$PATH
# ./configure –prefix=/usr/local –with-apxs2=/usr/local/apache2/bin/apxs –with-config-file-path=/usr/local/apache2/conf –with-gd –with-pear –with-gettext –with-mime-magic –with-zlib-dir=/opt/freeware/lib –enable-shared –disable-static –with-png –with-zlib –with-bz2 –with-xml –with-jpeg-dir=/opt/freeware/lib –with-png-dir=/opt/freeware/lib –with-xpm-dir=/opt/freeware/lib –with-freetype-dir=/opt/freeware/lib
3. Compile PHP with the following command:
# make
NOTE: There will be compiler warnings about pointers type mismatches. The can be disregarded.
4. Install PHP with the following two commands
# cp .libs/libphp5.so /usr/local/apache2/modules
# cp php.ini-recommended /usr/local/apache2/conf/php.ini
Configuring Apache2 with PHP
1. Stop Apache2
# /usr/local/apache2/bin/apachectl -k stop
2. Edit /usr/local/apache2/conf/httpd.conf, adding the following at the end
LoadModule php5_module modules/libphp5.so AddType application/x-httpd-php .php DirectoryIndex index.php
3. Edit the /usr/local/apache2/conf/php.ini file
Change the php variable:
;date.timezone =
to reflect your timezone
4. Restart Apache2
# /usr/local/apache2/bin/apachectl -k start
5. Now test PHP with Apache2
- Create a test web page
# vi /usr/local/apache2/htdocs/phpinfo.php
<?php phpinfo() ?>
- Open the page in your browser: http://localhost/phpinfo.php
- Verify the php data
- Delete phpinfo.php
# rm /usr/local/apache2/htdocs/phpinfo.php
Common Problem
Making all in pcre make[2]: Entering directory `/tmp/install/apache/httpd-2.2.11/srclib/pcre’ make[3]: Entering directory `/tmp/install/apache/httpd-2.2.11/srclib/pcre’ /tmp/install/apache/httpd-2.2.11/srclib/apr/libtool –silent –mode=compile gcc -g -O2 -pthread -U__STR__ -D_THREAD_SAFE -D_USE_IRS -D_LARGEFILE64_SOURCE -I/tmp/install/apache/httpd-2.2.11/srclib/pcre -I. -I/tmp/install/apache/httpd-2.2.11/os/unix -I/tmp/install/apache/httpd-2.2.11/server/mpm/prefork -I/tmp/install/apache/httpd-2.2.11/modules/http -I/tmp/install/apache/httpd-2.2.11/modules/filters -I/tmp/install/apache/httpd-2.2.11/modules/proxy -I/tmp/install/apache/httpd-2.2.11/include -I/tmp/install/apache/httpd-2.2.11/modules/generators -I/tmp/install/apache/httpd-2.2.11/modules/mappers -I/tmp/install/apache/httpd-2.2.11/modules/database -I/tmp/install/apache/httpd-2.2.11/srclib/apr/include -I/tmp/install/apache/httpd-2.2.11/srclib/apr-util/include -I/tmp/install/apache/httpd-2.2.11/srclib/apr-util/xml/expat/lib -I/tmp/install/apache/httpd-2.2.11/modules/proxy/../generators -I/tmp/install/apache/httpd-2.2.11/modules/ssl -I/tmp/install/apache/httpd-2.2.11/modules/dav/main -prefer-non-pic -static -c maketables.c && touch maketables.lo In file included from internal.h:55, from maketables.c:48: /opt/freeware/lib/gcc/powerpc-ibm-aix5.3.0.0/4.2.0/include/setjmp.h:123: error: ‘_UKJBLEN’ undeclared here (not in a function) make[3]: *** [maketables.lo] Error 1 make[3]: Leaving directory `/tmp/install/apache/httpd-2.2.11/srclib/pcre’ make[2]: *** [all-recursive] Error 1 make[2]: Leaving directory `/tmp/install/apache/httpd-2.2.11/srclib/pcre’ make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/tmp/install/apache/httpd-2.2.11/srclib’ make: *** [all-recursive] Error 1
This error is caused by the _UKJBLEN function not existing prior to AIX 5.3 TL5. This can be fixed by installing the TL5 update.
Leave a Reply
Additional comments powered by BackType



