I am attempting to install PHP 5.3.1 using CGI, but php-cgi seems to have vanished in PHP 5.3.1. I've tried both the --enable-cgi and --disable-cli flags for ./configure, but it doesn't create the php-cgi binary under the sapi/cgi subdirectory. However, I was able to get this working in PHP 5.3.0 just fine using the same exact procedure.
I am building from source on RHEL4 and used the following configuration: ./configure --prefix=/usr/local/php-5.3.1 --with-openssl --with-zlib --enable-bcmath --with-bz2 --enable-calendar --with-curl --enable-exif --enable-ftp --with-gd --with-jpeg-dir=/usr --with-png-dir=/usr --with-freetype-dir=/usr --enable-gd-native-ttf --with-gettext --with-gmp --with-mhash --with-imap --with-kerberos --with-imap-ssl --with-ldap --enable-mbstring --with-mcrypt --with-mysql --with-mysql-sock=/var/lib/mysql/mysql.sock --with-mysqli --enable-pcntl --with-pdo-mysql --with-pspell --enable-shmop --enable-soap --enable-sockets --enable-sqlite-utf8 --enable-sysvmsg --enable-sysvsem --enable-sysvshm --with-tidy --enable-wddx --with-xmlrpc --with-xsl=/usr/local --enable-zip --with-pear --with-libxml-dir=/usr/local --enable-cgi --disable-cli -Geoffrey Lee