configure php with postgresql and apache

Hi,
I'm trying to configure php4 to run alongside postgresql and apache. Postgres and apache are already installed and running, but I am getting an error when doing:
host84:~/php-4.4.9#./configure --with-apache=/usr/local/apache --with-postgresql=/usr/local/pgsql

loading cache ./config.cache
checking for egrep... (cached) grep -E
checking for a sed that does not truncate output... (cached) /bin/sed
expr: syntax error
./configure: test: =: unary operator expected
expr: syntax error
./configure: test: =: unary operator expected
expr: syntax error
./configure: test: =: unary operator expected
expr: syntax error
./configure: test: =: unary operator expected
expr: syntax error
./configure: test: =: unary operator expected
checking host system type... i686-pc-linux-gnu
checking for gcc... (cached) gcc
checking whether the C compiler (gcc ) works... yes
checking whether the C compiler (gcc ) is a cross-compiler... no
checking whether we are using GNU C... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking whether gcc and cc understand -c and -o together... (cached) yes
checking how to run the C preprocessor... (cached) gcc -E
checking for AIX... no
checking if compiler supports -R... (cached) no
checking if compiler supports -Wl,-rpath,... (cached) yes
checking for re2c... (cached) exit 0;
checking whether ln -s works... (cached) yes
checking for gawk... (cached) gawk
checking for bison... no
checking for byacc... no
configure: warning: You will need bison if you want to regenerate the PHP parsers.
checking for flex... (cached) flex
checking for yywrap in -lfl... (cached) yes
checking lex output file root... (cached) lex.yy
checking whether yytext is a pointer... (cached) yes
checking for working const... (cached) yes
checking flex version... 2.5.4 (ok)
checking whether byte ordering is bigendian... (cached) no
checking whether to force non-PIC code in shared modules... yes
checking for pthreads_cflags... (cached) -pthread
checking for pthreads_lib... (cached)

Configuring SAPI modules

checking for AOLserver support... no
checking for Apache 1.x module support via DSO through APXS... no
checking for Apache 1.x module support... no
configure: error: Invalid Apache directory - unable to find httpd.h under /usr/local/apache

I'm sure the path to apache is fine. I'd appreciate any advice. Thank you.

What OS? What shell are you running?

try running

sh ./configure ...

Hi Frank,
This is what I have in place.
OS: Red Hat Linux 3.2.3-54
shell: /bin/bash

I tried:
sh ./configure...
Same results, invalid apache directory.
How do I know if I need to install the shared or the static version?
Thanks in advance.

Can you confirm that the apache is install is at /usr/local/apache ? What does ls -lart /usr/local/apache show?

Thanks Frank for get back to the post.
1)Checked httpd.conf out and it shows the top of directory tree:
/usr/local/apache

2) ls -lart /usr/local/apache
drwxr-xr-x 4 root root 4096 Aug 4 11:48 man
drwxr-xr-x 2 nobody nobody 4096 Aug 4 11:48 proxy
drwxr-xr-x 3 root root 4096 Aug 4 11:48 include
drwxr-xr-x 2 root root 4096 Aug 4 11:49 cgi-bin
drwxr-xr-x 12 root root 4096 Aug 21 22:55 .
drwxr-xr-x 2 root root 4096 Sep 2 19:57 bin
drwxr-xr-x 3 root root 4096 Sep 2 19:57 icons
drwxr-xr-x 2 root root 4096 Sep 2 20:54 libexec
drwxr-xr-x 2 root root 4096 Sep 2 20:54 conf
drwxr-xr-x 3 root root 4096 Sep 2 21:46 htdocs
drwxr-xr-x 14 root root 4096 Sep 3 00:00 ..
drwxr-xr-x 2 nobody nobody 4096 Sep 19 01:36 logs

Are the php extensions the ones I suppose to use?