29.5. Configure and apply PHP4 to Apache source

Now, move into the new php4 directory cd ../php-4.0 and type the following commands on your terminal:

  1. Edit the php_pgsql.h file, vi ext/pgsql/php_pgsql.h and change the lines:
    
          #include libpq-fe.h
              #include libpq/libpq-fs.h
            
    To read:
    
          #include /usr/include/pgsql/libpq-fe.h
              #include /usr/include/pgsql/libpq/libpq-fs.h
            
    These modifications in the php_pgsql.h file are necessary to indicate the location of our libpq-fe.h, and libpq-fs.h header files of PostgreSQL database during configure of PHP4. In Red Hat Linux, the libraries of PostgreSQL are located under /usr/include/pgsql.

  2. Now, we must configure and install PHP4 in the Linux server:
    
          CC="egcs" \
              CFLAGS="-O9 -funroll-loops -ffast-math -malign-double -mcpu=pentiumpro -march=pentiumpro -fomit-frame-pointer -fno-exceptions -I/usr/include/openssl" \
              ./configure \
              --prefix=/usr \
              --with-exec-dir=/usr/bin \
              --with-apache=../apache_1.3.12 \
              --with-config-file-path=/etc/httpd \
              --disable-debug \
              --enable-safe-mode \
              --with-imap \                (1)
              --with-ldap \                (2)
              --with-pgsql \               (3)
              --with-mm \
              --enable-inline-optimization \
              --with-gnu-ld \
              --enable-memory-limit
            

    (1)
    If you want IMAP & POP support.
    (2)
    If you want LDAP database light directory support.
    (3)
    if you want PostgreSQL database support.
    This tells PHP4 to set itself up for this particular hardware setup with:

    • Compile without debugging symbols.

    • Enable safe mode by default.

    • Include IMAP & POP support.

    • Include LDAP directory support.

    • Include PostgresSQL database support.

    • Include mm support to improve performance of Memory Library.

    • Enable inline-optimization for better performance.

    • Compile with memory limit support.

    • Assume the C compiler uses GNU ld.

  3. 
        [root@deep ]/php-4.0# make 
            [root@deep ]/php-4.0# make install