Now, move into the new php4 directory cd ../php-4.0 and type the following commands on your terminal:
    
        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.
      
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 \                 --with-ldap \
          --with-ldap \                 --with-pgsql \
          --with-pgsql \                --with-mm \
          --enable-inline-optimization \
          --with-gnu-ld \
          --enable-memory-limit
          --with-mm \
          --enable-inline-optimization \
          --with-gnu-ld \
          --enable-memory-limit
        
| If you want IMAP & POP support. | |
| If you want LDAP database light directory support. | |
| 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.
        [root@deep ]/php-4.0# make 
        [root@deep ]/php-4.0# make install