# upgrade PHP



## Reken (Apr 27, 2021)

How to upgrade php via portupgrade?
Need to update with dependencies
Characteristics: FreeBSD 11.4 PHP72 (need to upgrade to 74)

portupgrade -rR php72 (doesn't work, errors ...)
php74 conflicts with php72-hash (Installs files into the same place)


----------



## SirDice (Apr 27, 2021)

Any reason why you're using ports? If you simply run `pkg upgrade` it will get upgraded pretty much automatically. You'll only need to install www/mod_php74 yourself (if you use mod_php).


----------



## RypPn (Apr 27, 2021)

Hash is now part of core






						FreshPorts -- security/php74-hash: The hash shared extension for php
					

PHP, which stands for "PHP: Hypertext Preprocessor" is a widely-used Open Source general-purpose scripting language that is especially suited for Web development and can be embedded into HTML.  Its syntax draws upon C, Java, and Perl, and is easy to learn.  The main goal of the language is to...




					www.freshports.org


----------



## msplsh (Apr 27, 2021)

The three-line FreeBSD recommended shell code I saw for upgrading Python can be easily changed for PHP.

Upgrading Python with pkg


----------



## SirDice (Apr 27, 2021)

I've had zero problems just running `pkg upgrade` when moving from PHP 7.2 to 7.4. Most of the time pkg(8) already does the right thing.


----------



## richardtoohey2 (Apr 27, 2021)

/usr/ports/UPDATING has a few hints, but it's basically a manual process:
	
	



```
20200914:
  AFFECTS: users of lang/php72
  AUTHOR: tz@FreeBSD.org

  The default version of PHP has been switched from 7.2 to 7.4.

  If you use binary packages you should make a list of php packages
  before running 'pkg upgrade':

  # pkg info php7\* > ~/installed-php-ports-list

  After the upgrade, check with such list if all your php extensions
  are still installed, and reinstall them if needed.

  If you use mod_php72 you need to deinstall it and install mod_php74.
```
Basically boils down to making a list of installed extensions, then delete your installed PHP and extensions, build & install the new PHP, build & install the extensions you need (made from the pkg info step).  If you use mod_php remember to take care of that too.

Sounds like a faff but doesn't take that long (30 minutes?)  I'd recommend backing up config files, and if you've got a test system or VM, I'd recommend installing PHP 7.2 on there and doing a test upgrade to PHP 7.4 to give yourself some confidence it's going to work.


----------



## covacat (Apr 27, 2021)

building php74-extensions from ports bombed for me a few days ago on 11.4 box
had to manually touch
/usr/local/include/php/ext/php_config.h  and then it went ok (mostly)


----------

