4

Basically, I usually do something like this:

# portsnap fetch
# portsnap update

# portmaster -L | grep -B1 "New version"
    ===>>> php5-5.2.11
    ===>>> New version available: php5-5.2.12
# portmaster php5-5.2.11

But with PHP I've got about 40 modules and have to them one by one. Is there a better (and safe) way to do this?

Edit: well it turns out that this is what's needed:

# portmaster php5-extensions

It's amazing how hard that was to find out!

Stefan Lasiewski
  • 23,667
  • 41
  • 132
  • 186
Gazzer
  • 185
  • 1
  • 2
  • 9

4 Answers4

6
portmaster -db php5*
3

Firstly I should say that I don't use portmaster, I use portupgrade, but then I build ports rather than use packages!

Portupgrade allows you to put:

portupgrade php\*

which will upgrade all the php ports. Portmaster may do the same thing.

Also you can give portsnap multiple commands in one go, so you can put

portsnap fetch update
hmallett
  • 2,455
  • 14
  • 26
  • I can just install portupgrade and use that then. There's no problem with using them together? – Gazzer Jan 24 '10 at 19:22
  • I don't know, as I've never used portmaster! If you use portupgrade then you can use the -P switch to use packages rather than ports where possible. – hmallett Jan 24 '10 at 19:42
  • 1
    Using the new package manager system (The old one was EOL in September 2014), ports and packages can work together without stepping on each other. Portmaster can use either. Portmaster does have one nice feature not in portupgrade, it will ask all of the config questions up front and then do the build, rather than the portupgrade default of doing the config question as each port is built. Having used portupgrade for years and then switching to portmaster recently, I find it nicer. – Walter Sep 26 '14 at 00:14
1

I rebuild/update all packages depending on php5 for safety. You need to specify the full pkg-name including version. Find out the exact version with pkg_info:

# pkg_info|grep php
php5-5.3.8          PHP Scripting Language

Then rebuild/update php and all ports depending on it with:

# portmaster -r php5-5.3.8
0

A more modern answer using only pkg is:

pkg install `pkg info | grep php | sed 's/72/74/; s/-7.*//'`

The example upgrades PHP 7.2 to 7.4. The first sed command needs to be adjusted for the installed and target versions of PHP.

The version resolution of pkg doesn't know that some PHP extensions needed in older versions of PHP are now part of PHP 7.4. You might have to remove a couple of them with a command like this: pkg delete -fy php72-hash.

Matt Simerson
  • 409
  • 3
  • 9