PHP and PHP-Extensions

Matthew Seaman m.seaman at
Wed Dec 17 22:54:52 UTC 2008

Grant Peel wrote:

> I have a somewhat broken installation of php 4.4.7 and the extensions
> and want to completely remove them and reinstall them.
> How does one conpletely remove php4 (from ports) and the extensions
> to ensure a clean install?

Make sure you have good backups.  Also make sure you have a handy list of
all the ports you started with:

  # pkg_info -Ia > /root/initial.ports

Now, delete the lang/php4 port and everything that depends on it.  The
easiest way to do this is with the pkg_deinstall program which is part
of portupgrade(1):

  # pkg_deinstall -dfr php4 

'php4' is actually a packagename glob, so this will delete any package
mentioning 'php4' in its name, plus every thing depending on those ports.
So it will delete pure PECL or PEAR code modules and end user applications
as well.

Then regenerate the list of ports you've got installed and diff it
against the initial list as a sanity check:

  # pkg_info -Ia > /root/final.ports
  # diff -u initial.ports final.ports

That should be pretty much it.  If you've stripped out everything PHP
related then /usr/local/lib/php/ and /usr/local/share/pear/ should be
empty or gone completely, and there should be no ports left with 'php',
'pear' or 'pecl' prominently in their names.  Nor should you have
'eaccelerator' or 'zend' related stuff still there.

You'll still have some PHP related files in /usr/local/etc/ which you
can delete or not as required -- they all have php in the name or
directory path making them quite easy to identify.  Note however that
if you're intending to upgrade to PHP5 then you must delete
/usr/local/etc/php.conf first, as that's the file that tells
which version of PHP you're using.



Dr Matthew J Seaman MA, D.Phil.                   7 Priory Courtyard
                                                  Flat 3
PGP:     Ramsgate
                                                  Kent, CT11 9PW

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 258 bytes
Desc: OpenPGP digital signature
Url :

More information about the freebsd-questions mailing list