FreeBSD Apache 20 PHP4, PHP5 FreeBSD
`libphp5.la' is not a valid libtool archive
libphp5.so: No such file or directory
(apxs:Error: Command failed with rc=65536)

Note: The following took me almost two days to figure out. This is only my second install of FreeBSD or any UNIX variant, but I was actually able to figure some of this out on my own. What I didn't figure out on my own, I figured out after doing some Googling and putting two and two together. Do a Google, there are tons of people getting this error but you can spend days and not find a clear, easy solution that will let you install from ports instead of installing manually (hey, the whole point of ports is they are supposed to make installing easy for everyone). Here is an easy fix that even a newbie should be able to understand.

You install Apache 2.0 from ports just fine and get this error when trying to install either PHP4 or PHP5. Uninstall Apache 2.0 and install Apache 2.1. You still get this same error:

===> Installing for php5-5.0.4_2
===> php5-5.0.4_2 depends on file: /usr/local/sbin/apxs - found
===> php5-5.0.4_2 depends on executable: pkg-config - found
===> php5-5.0.4_2 depends on shared library: xml2.5 - found
===> Generating temporary packing list
===> Checking if lang/php5 already installed
Installing PHP SAPI module: apache2handler
/usr/local/share/apache21/build/instdso.sh SH_LIBTOOL='/usr/local/build-1/libtool' libphp5.la /usr/local/libexec/apache21
/usr/local/build-1/libtool --mode=install cp libphp5.la /usr/local/libexec/apache21/
libtool: install: `libphp5.la' is not a valid libtool archive
Try `libtool --help --mode=install' for more information.
apxs:Error: Command failed with rc=65536
.
*** Error code 1

Stop in /usr/ports/lang/php5/work/php-5.0.4.
*** Error code 1

To get past this error:

cd /usr/ports/lang/php5/work/php-5.0.4/libs
and issue this command:

cp libphp5.la /usr/local/build-1/libtool

This will get you past the above error, but next you will get this one:

make install
===> Installing for php5-5.0.4_2
===> php5-5.0.4_2 depends on file: /usr/local/sbin/apxs - found
===> php5-5.0.4_2 depends on executable: pkg-config - found
===> php5-5.0.4_2 depends on shared library: xml2.5 - found
===> Generating temporary packing list
===> Checking if lang/php5 already installed
Installing PHP SAPI module: apache2handler
/usr/local/share/apache21/build/instdso.sh SH_LIBTOOL='/usr/local/build-1/libtool' libphp5.la /usr/local/libexec/apache21
/usr/local/build-1/libtool --mode=install cp libphp5.la /usr/local/libexec/apache21/
grep: /usr/local/libexec/apache21/libphp5.la: No such file or directory
grep: /usr/local/libexec/apache21/libphp5.la: No such file or directory
Warning! dlname not found in /usr/local/libexec/apache21/libphp5.la.
Assuming installing a .so rather than a libtool archive.
chmod 755 /usr/local/libexec/apache21/libphp5.so
chmod: /usr/local/libexec/apache21/libphp5.so: No such file or directory
apxs:Error: Command failed with rc=65536
.
*** Error code 1

Stop in /usr/ports/lang/php5/work/php-5.0.4.
*** Error code 1

Stop in /usr/ports/lang/php5.

Notice the "grep: /usr/local/libexec/apache21/libphp5.la: No such file or directory"

You can fix that by doing this:

cd /usr/ports/lang/php5/work/php-5.0.4/libs
cp libphp5.la /usr/local/libexec/apache21

Notice the next error: chmod: /usr/local/libexec/apache21/libphp5.so: No such file or directory

cd /usr/ports/lang/php5/work/php-5.0.4/libs

cp libphp5.so /usr/local/libexec/apache21/

PHP 5 installes at this point with commands:

cd /usr/ports/lang/php5

make install

 

Note: You should add the following to your Apache configuration file:

AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps