Installing PHP 5 on AIX using IBM HTTP Server

0.00 avg. rating (0% score) - 0 votes

I was not able to compile PHP 5.2.6 with IBM HTTP Server 6.1 as a module, so I compiled it as a CGI binary instead. Here’s how to do it.

1. Download the AIX toolbox from:

ftp://ftp.software.ibm.com/aix/freeSoftware/aixtoolbox/RPMS/ppc/

You don’t need to download everything, but that is the easiest way. The whole toolbox is about 2.8 GB in size. If you have wget, just say:

2. Install GCC and the rest of the GNU toolchain

Go to the toolbox dir and run the following command.

You will probably want to replace the package names with the newest versions.

3. Install PHP 5 prerequisites

In the same toolbox dir, run:

This really depends on what you want to compile in. My settings will require the stuff listed above.

Also, install fileset bos.adt.libm from the AIX installation media.

4. Download and unpack the latest PHP 5

Download the latest version from:

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

I downloaded 5.2.6. Unpack:

5. Configure PHP 5

The AIX toolbox packages have been compiled with a default prefix of /opt/freeware, and that is where all the files from the packages are installed. As we compile php from scratch, it is good practice to configure the php package to go under /usr/local (see the “prefix” below). The “with-config-file-path” sets the the place where PHP searches for its’ configuration file.

6. Compile

Compile:

You may run into the following errors while compiling:

cc1: out of memory allocating XXX bytes after a total YYY of bytes

This is a ulimit issue. Rise the soft limits to overcome it:

execvp: /bin/sh: The parameter or environment lists are too long.

The parameter list to a command is too long. This limit can be raised. Check out the size with this command:

Rise it with this command:

7. Test

8. Install

9. Configure IHS

I added the following lines to httpd.conf:

Also, to make index.php work, modify the DirectoryIndex directive:

10. Test that everything works

Test the configuration with:

And restart IHS to make the new configuration effective:

Links

Using the GNU C/C++ compiler on AIX
http://www.ibm.com/developerworks/aix/library/au-gnu.html
– The authors explain why you should use GCC compiler, which compiler options are specific to pSeries, what you need to know about shared libraries, and common gotchas and solutions.

IBM AIX Toolbox download information
http://www-03.ibm.com/systems/power/software/aix/linux/toolbox/download.html

Hosting PHP Applications on the IBM HTTP Server
http://www.ibm.com/developerworks/opensource/library/os-phphttp/

Raising the command line and environment limit:
http://www.ibm.com/developerworks/forums/thread.jspa?threadID=170563

7 thoughts on “Installing PHP 5 on AIX using IBM HTTP Server”

  1. Did you come across this error ?
    /home/epdadm/opensource/php/php-5.2.8/ext/pcre/pcrelib/pcre_internal.h:976: error: parse error before ‘BOOL’

    It’s more than one line. I’m guessing if u fix this, u’ll fix it all

    Regards

  2. Hi Harie,

    I solved this error as described in the following link:
    http://bugs.php.net/bug.php?id=46040

    edit the file “ext/pcre/pcrelib/pcre_internal.h” as follows:

    ! #ifndef FALSE
    typedef int BOOL;

    #define FALSE 0
    #define TRUE 1
    #endif

    to ==>

    ! #ifndef BOOL
    typedef int BOOL;
    + #endif

    + #ifndef FALSE
    #define FALSE 0
    #define TRUE 1
    #endif

    Hope that helps you, too.
    Regards

  3. thanks for the informations provided mikko!

    i’m trying to get it running with aix 6.1 and apache 2.2

    for all followers please be aware you have to change some versions of the aix toolbox, so they fit to your aix version (6.1 in my case), especially the gcc will fail otherwise.

    unfortunately im running into the same error since days: no libphp5.so is generated and therefor the “make install” command crashes:

    ===

    Installing PHP SAPI module: apache2handler
    /usr/local/apache2/build/instdso.sh SH_LIBTOOL=’/usr/local/apache2/build/libtool’ libphp5.la /usr/local/apache2/modules
    rm -f /usr/local/apache2/modules/libphp5.so
    /usr/local/apache2/build/libtool –mode=install cp libphp5.la /usr/local/apache2/modules/
    cp .libs/libphp5.lai /usr/local/apache2/modules/libphp5.la
    cp .libs/libphp5.a /usr/local/apache2/modules/libphp5.a
    chmod 644 /usr/local/apache2/modules/libphp5.a
    ranlib /usr/local/apache2/modules/libphp5.a
    libtool: install: warning: remember to run `libtool –finish /home/install/php-5.2.8/libs’
    Warning! dlname not found in /usr/local/apache2/modules/libphp5.la.
    Assuming installing a .so rather than a libtool archive.
    chmod 755 /usr/local/apache2/modules/libphp5.so
    chmod: /usr/local/apache2/modules/libphp5.so: A file or directory in the path name does not exist.
    apxs:Error: Command failed with rc=65536
    .
    make: *** [install-sapi] Error 1

    ===

    any solutions? 🙂

  4. Well done, nut phpinfo said:”extension_dir /usr/local/lib/php/extensions/no-debug-zts-20060613″.
    I need to use PDO to connect the DB, how can i update the “extension_dir”?

  5. Hi,

    if make interupts with an out of memory error, try to erase the option “-O” from the CFLAG-option inside of the Makefile.

    kind regards
    steffen

  6. Pingback: Colchicine
  7. Hi guys,

    I am working on PHP with a AIX 6.1 box too. My friend and I spent a week to make it work. The missing phplib5.so problem was solved by add “–enable-libgcc” to the configure command. I am not sure if it works for your case.

    Now, we are having problem of PCRE. It is not working in AIX while running without problem on Linux and Wins. Does it a bug? any hint? Thanks.

Leave a Reply to Yves Cancel reply