If you must compile on Red Hat, CentOS or other Red Hat-derivatives, I recommend you use rpmbuild -bb (I'll explain in the moment) with the .spec.in provided in the php source either by Red Hat or by upstream developer (PHP). Here is a sample from the upstream:
%define version @VERSION@
%define so_version 5
%define release 0
Summary: PHP: Hypertext Preprocessor
Copyright: The PHP license (see "LICENSE" file included in distribution)
Packager: PHP Group <firstname.lastname@example.org>
PHP is an HTML-embedded scripting language. Much of its syntax is
borrowed from C, Java and Perl with a couple of unique PHP-specific
features thrown in. The goal of the language is to allow web
developers to write dynamically generated pages quickly.
./configure --prefix=/usr --with-apxs \
# figure out configure options options based on what packages are installed
# to override, use the OVERRIDE_OPTIONS environment variable. To add
# extra options, use the OPTIONS environment variable.
#test rpm -q MySQL-devel >&/dev/null && OPTIONS="$OPTIONS --with-mysql=shared"
#test rpm -q solid-devel >&/dev/null && OPTIONS="$OPTIONS --with-solid=shared,/home/solid"
#test rpm -q postgresql-devel >&/dev/null && OPTIONS="$OPTIONS --with-pgsql=shared"
test rpm -q expat >&/dev/null && OPTIONS="$OPTIONS --with-xml=shared"
if test "x$OVERRIDE_OPTIONS" = "x"; then
./configure --prefix=/usr --with-apxs=$APXS $OPTIONS
See where it says "--with-apxs"? That is part of development interfaces for the Apache HTTP server. If that is not installed, you will get when running configure (and I believe that is what you are seeing):
Configuring SAPI modules
checking for AOLserver support... no
checking for Apache 1.x module support via DSO through APXS...
Sorry, I was not able to successfully run APXS. Possible reasons:
1. Perl is not installed;
2. Apache was not compiled with DSO support (--enable-module=so);
3. 'apxs' is not in your path. Try to use --with-apxs=/path/to/apxs
The output of apxs follows
./configure: line 4092: apxs: command not found
configure: error: Aborting
To compile without apxs support (and thus avoiding the need for apache), you would change that to:
And it will get that pass that point.
Now back to building with a spec file. if you build it with a spec file, rpmbuild will tell you what dependencies you need that will allow you to install. And from there, it will build a package for you and you can install it with:
yum localinstall php.rpm
Which will then allow you to install as well as satisfy the other requirements. That will save you lot of grief by managing your system properly with a packaging system rather than trying to build and install manually.
(or you can follow embobo's advice and install just php-cli ;) ).