# Upgrade Ports



## millionaire_mind (Feb 6, 2011)

I'm so afraid to upgrade my ports because last time I did it, something happened and it took me days to get the server working as it was before the upgrade.

This is what I have in my notes:


```
portsnap fetch extract update
pkgdb -F
cd /usr/ports
portsdb -Uu
portupgrade -a
shutdown -r now
```

Is this still the "proper" way to do it?  Any files in particular that I should backup before doing so.


----------



## JokerBoy (Feb 6, 2011)

this should be used only the first time
[cmd='']portsnap fetch extract[/cmd]
then to update the ports tree
[cmd='']portsnap fetch update[/cmd]


----------



## pelmen (Feb 6, 2011)

One of the important stage before portupgrade: reading /usr/ports/UPDATING


----------



## wblock@ (Feb 6, 2011)

That's not quite the correct use of portsnap, although I guess it would work.  -a to either portupgrade or portmaster is drastic and sometimes fails.  A reboot after updating ports is not required, either, although you may need to manually restart services that were upgraded.  I tried to collect the basic updating steps in Upgrading FreeBSD Ports.


----------



## millionaire_mind (Feb 6, 2011)

wblock, I followed the steps you describe in your link.  The only problem is that I did [cmd=]portversion -vl'<'[/cmd] about 100 things came up.  How do I do the [cmd=]portupgrade -r[/cmd] with so many items needing to be updated?


----------



## millionaire_mind (Feb 6, 2011)

To tell you the honest truth, I only want to upgrade PHP, because I'm afraid if I do all the others my server will not function right.  It's running great right now.


----------



## millionaire_mind (Feb 6, 2011)

Even just the php ones are:


```
php5-bz2-5.3.2              <  needs updating (port has 5.3.5)
php5-ctype-5.3.2            <  needs updating (port has 5.3.5)
php5-curl-5.3.2             <  needs updating (port has 5.3.5)
php5-dom-5.3.2              <  needs updating (port has 5.3.5)
php5-ftp-5.3.2              <  needs updating (port has 5.3.5)
php5-gd-5.3.2               <  needs updating (port has 5.3.5)
php5-gettext-5.3.2          <  needs updating (port has 5.3.5)
php5-hash-5.3.2             <  needs updating (port has 5.3.5)
php5-iconv-5.3.2            <  needs updating (port has 5.3.5)
php5-imap-5.3.2             <  needs updating (port has 5.3.5)
php5-ldap-5.3.2             <  needs updating (port has 5.3.5)
php5-mbstring-5.3.2         <  needs updating (port has 5.3.5)
php5-mcrypt-5.3.2           <  needs updating (port has 5.3.5)
php5-mysql-5.3.2            <  needs updating (port has 5.3.5)
php5-mysqli-5.3.2           <  needs updating (port has 5.3.5)
php5-openssl-5.3.2          <  needs updating (port has 5.3.5)
php5-pdo-5.3.2              <  needs updating (port has 5.3.5)
php5-session-5.3.2          <  needs updating (port has 5.3.5)
php5-simplexml-5.3.2        <  needs updating (port has 5.3.5)
php5-soap-5.3.2             <  needs updating (port has 5.3.5)
php5-sqlite-5.3.2           <  needs updating (port has 5.3.5)
php5-xml-5.3.2              <  needs updating (port has 5.3.5)
php5-xmlrpc-5.3.2           <  needs updating (port has 5.3.5)
php5-zlib-5.3.2             <  needs updating (port has 5.3.5)
```


----------



## wblock@ (Feb 6, 2011)

I don't know what to tell you about PHP; lots of people fight with it.  (Not me, I quit using it years ago.)

It's difficult to upgrade some ports while leaving the rest alone.  The ones being upgraded inevitably depend on newer versions of other ports, and those in turn depend on others.  It's hard to keep an interlinked web of dependencies working without keeping them all at the same era of the ports tree.

Some people recommend deleting all ports and reinstalling as faster than a mass in-place upgrade.  Problems can happen either way.  portmaster(8) shows how to remove all ports and reinstall them at the end of the man page.  That would involve some downtime.

If uptime is critical, you can test the port upgrade procedure on a duplicate system, or in a VM or jail.


----------

