Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

On my FreeBSD (home) server I have installed 6.2-RELEASE-p8. This "includes" PHP 5.1. I need to install PHP 5.2 now (because of a dependency, 5.3 would probably also work).

Now my (newbie) question is: (how) can I get the ports collection (csup?) to let me install PHP 5.2 on my 6.2-RELEASE? Is this even possible? And is this a good (or at least acceptable) thing to do?

And would I have to have a watchful eye on the PHP extensions (e.g. php5-gd or php5-mysql etc.) or should/would they be updated automagically?

I would also appreciate a link into the handbook if available. I seem to be putting the wrong terms into the various searchboxes I tried :(.


Sorry for the possible confusion. I do have/use csup already. Here comes the content of my current ports-supfile:

*default host=cvsup.ch.FreeBSD.org
*default base=/var/db
*default prefix=/usr
*default release=cvs tag=RELEASE_6_2_0 # Release FreeBSD 6.2
*default delete use-rel-suffix
*default compress
share|improve this question
add comment

1 Answer

up vote 1 down vote accepted
  1. Install cvsup

    cd /usr/ports/net/cvsup-without-gui make install clean

  2. Configure a CVSUP file for the ports tree, create a file with these contents:

    *default tag=.
    *default host=cvsup.FreeBSD.org
    *default prefix=/usr
    *default base=/var/db
    *default release=cvs delete use-rel-suffix

    if you want to update the src tree, change the first line to the version you want and the last line like this:

    *default tag=RELEND_8

    (This would be for the latest 8.x-STABLE source, change 8 to 6 for 6.x-STABLE)

  3. Run cvsup against the update file: cvsup cvsup.file. Wait, it'll take 15 to 60 minutes depending on what has to be updated.

  4. Install the newer PHP from the ports tree.

    cd /usr/ports/lang/php5 (for 5.3, or php52 for 5.2)
    make install clean
  5. Update your php extensions (the most common ones are collected into a meta-port):

    cd /usr/ports/lang/php5-extensions
    make config
    [select the extensions you want built from the list]
    make install clean
  6. If this is for an Apache server you might have to change the configuration there. But that depends on how it's setup.

Handbook - Using CVSup
Handbook - Using Ports
Handbook - Apache HTTP Server (including some PHP info)

There are a couple of options. You can rename the current ports directory (preserving it while you grab a new copy and update PHP from there). The advantage of this route is building PHP on your machine should result in proper library dependencies already being present. Also, your original cvsup file has the 6.2 tag in it, meaning you'll only ever get the ports that came with 6.2-RELEASE; nothing will ever be updated. This is useful if you want to download a copy of the original port tree again (you can delete the ports tree and use cvsup to download the whole thing again), but otherwise isn't very useful as nothing ever changes.

An alternate route is to download the updated packages and manually install them. There's a good chance this will not work on account of shared libraries being out of date and having to use pre-built binaries; but it will definitely insulate your current ports tree.

You can download the newest packages from the FreeBSD FTP site. You'll need php5.tbz (or php52.tbz), and any of the extensions you currently have installed (make sure you get the corresponding version, 5 or 52, and keep in mind that 5 is version 5.3).

Then pkd_delete -f [pkg_name] each of the packages and reinstall them from the package files with pkg_add [package.tbz].

I'm not sure what the dependency differences are between the versions, so there's a chance you'll have to upgrade other ports as well (though i think this is unlikely).

share|improve this answer
@Chris S: thank you for the quick and extensive answer! I would appreciate if you could clarify one point. But first I have to admit that I probably led you to the assumption that I do not have csup yet (formulation of my question). That is not the case, I do have csup already. I will post my sup-file as edit in my question. Now what I need clarification for is the following: do I assume correctly that this procedure would wipe out my existing port-tree? Meaning that all ports would be "switched" to the new release (at least upon (re-)installation)? If yes, is this necessary... –  scherand Jul 13 '10 at 13:19
... or is there a way to just switch the release for PHP? –  scherand Jul 13 '10 at 13:19
If you hate to be, then don't :) My first language being German and not English I do not understand what Nazis got to do with it anyway (i.e. I do not know what the saying "to be nazi" means but I sure know what a Nazi is!). On the other hand, the command I am issuing is called csup not c**v**sup... csup man page. Maybe that is where the confusion comes from. –  scherand Jul 13 '10 at 19:33
@Chris S: thank you for your edit! I think I might try the first option. Because of the library dependencies as you mention. Cheers! –  scherand Jul 13 '10 at 19:34
Csup, I should have known, but it's been years since I heard of anyone using that. Heck, cvsup has been outdated by portsnap now. On the nazi reference: urbandictionary.com/define.php?term=grammar+nazi –  Chris S Jul 13 '10 at 19:42
show 1 more comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.