In comp.os.linux.setup Theo Kanter wrote:
> Following the guidelines in
> http://www.php.net/manual/en/install.unix.apache2.php
> I thought I might add PHP5 support to Apache 2. Apache runs fine. Php
> builds without the --with-apxs2 option. However when I added
> '--with-apxs2=/usr/sbin/apxs \' to the Pkgfile the
> php build fails ending with:
>
> [stuff deleted]
> Build complete.
> (It is safe to ignore warnings about tempnam and tmpnam).
>
> + install -D -m 755 sapi/cgi/php
> /usr/ports/contrib/php/work/pkg/usr/bin/php
> install: cannot stat `sapi/cgi/php': No such file or directory
> =======> ERROR: Building
> '/usr/ports/contrib/php/php#5.1.6-1.pkg.tar.gz'
> failed.
> bash-3.1#




If I'm not mistaken, there's mainly two ways to PHP-ize Apache2, one
the CGI (looks like what you're trying to do above) and the other, the
server module/apxs2filter, (libphp5.so, in the apache config file as:
LoadModule libphp5.so). Your configure command is probably botched,
trying to use the wrong one or both.

The last php I built was 5.2.0 (note new CURL issues when using the
lastest CURL), which gives a CLI (command line interface, /usr/bin/php
binary) and server module, libphp5.so, to load in Apache, from
something akin to this configure command. Hack off the stuff you don't
want support for, change any directories to where you want them, and
it should be a step in the right direction. PHP usually builds fine
with little fuss.



'./configure' \
'--prefix=/usr' \
'--cache-file=php-build.cache' \
'--sysconfdir=/etc' \
'--sharedstatedir=/var/log' \
'--localstatedir=/var/run' \
'--x-includes=/usr/X11R6/include' \
'--x-libraries=/usr/X11R6/lib' \
'--with-apxs2filter=/usr/bin/apxs' \
'--enable-force-cgi-redirect' \
'--enable-discard-path' \
'--enable-fastcgi' \
'--disable-path-info-check' \
'--disable-debug' \
'--with-config-file-path=/etc' \
'--with-config-file-scan-dir=/etc:/usr/etc:/usr/local/etc' \
'--with-exec-dir=/usr/libexec/php-sm-exec' \
'--enable-sigchild' \
'--enable-magic-quotes' \
'--disable-rpath' \
'--disable-ipv6' \
'--with-libxml-dir=/usr' \
'--with-openssl' \
'--with-zlib' \
'--enable-bcmath' \
'--with-bz2' \
'--enable-calendar' \
'--with-curl=/usr' \
'--with-curlwrappers' \
'--enable-dba' \
'--with-gdbm' \
'--with-db4=/usr' \
'--with-inifile' \
'--with-flatfile' \
'--enable-dbase' \
'--enable-exif' \
'--enable-filepro' \
'--enable-ftp' \
'--with-openssl-dir=/usr' \
'--with-gd' \
'--with-jpeg-dir=/usr' \
'--with-png-dir=/usr' \
'--with-zlib-dir=/usr' \
'--with-xpm-dir=/usr/X11R6' \
'--with-ttf=/usr/local' \
'--with-freetype-dir=/usr/local' \
'--with-t1lib=/usr' \
'--enable-gd-native-ttf' \
'--with-gettext' \
'--with-gmp' \
'--enable-mbstring' \
'--with-libmbfl' \
'--with-mhash' \
'--with-mime-magic=/etc/apache2/magic' \
'--with-ncurses' \
'--enable-pcntl' \
'--with-pspell' \
'--with-readline=/usr' \
'--enable-shmop' \
'--with-libxml-dir=/usr' \
'--with-snmp=/usr' \
'--with-openssl-dir=/usr' \
'--enable-soap' \
'--with-libxml-dir=/usr' \
'--enable-sockets' \
'--enable-sysvmsg' \
'--enable-sysvsem' \
'--enable-sysvshm' \
'--with-xmlrpc' \
'--with-xmlreader' \
'--with-xsl' \
'--with-pear=/usr/lib/php' \
'--enable-memory-limit' \
'--enable-zend-multibyte' \
'--with-tsrm-pth' \
'--enable-shared' \
'--enable-static' \
'--with-gnu-ld' \
'--with-mysql=/usr' \
'--with-mysql-sock=/var/run/mysql/mysqlsock'


Your /etc/apache2/httpd.conf should have lines like

LoadModule php5_module path/to/the/libphp5.so

DirectoryIndex index.html index.php index.shtml

# The extensions to send thru the php filter, here .php and .phtml
AddType application/x-httpd-php .php .phtml
AddType application/x-httpd-php-source .phps



The above is using source off php.net, if you're using a package or
distro, things may be a bit different.


--
One of these kids is not like the other; Three of
these kids are kinda the same; Can you guess which
kid is doing his own thing? Now it's time to play
our game; it's time to play our game...