# help beginner upgrade your php7.0 to latest 7.2



## marian78 (Feb 8, 2019)

Hi, im beginner and big fan to freebsd. I dont know, if this is right place for my post, but i hope. 
I installed on my old machine freebsd 11.0 with nextcloud 14 (FAMP). But now i wanting upgrade all packages and operating system.
Freebsd from 11.0 to 11.2 i already upgraded (with freebsd-update).

But have big problem with upgrading php7.0 to 7.2. Searched on internet some good tutorial for freebsd, how to upgrade php to 7.2, but dont finded any relevant for beginer, that will help me.

I trayed pkg upgrade php72, portmaster..... Still, after restart apache24 get errors in http-error.log, about misssing old folder for php extensions. So, next I trayed "ln -s" new extension folder ( for php 7.2) to old folder (for php 7.0), but get another errors, like, php api si compiled to another versions...

Thx, for all help.


----------



## SirDice (Feb 8, 2019)

Use packages. 

`pkg upgrade`



marian78 said:


> So, next I trayed "ln -s" new extension folder ( for php 7.2) to old folder (for php 7.0), but get another errors, like, php api si compiled to another versions...


This is never a solution, so remove it.


----------



## marian78 (Feb 8, 2019)

thx for answer, i will trying it over weekend.


----------



## faysal76 (Feb 8, 2019)

use this command first,
pkg remove php71

then use this command,
pkg install php72

i used this successfully.


----------



## SirDice (Feb 8, 2019)

A pkg-upgrade(8) is likely to automatically work. PHP 7.2 is the default now so any web PHP web application that's installed is going to depend on PHP 7.2. The upgrade will therefor automatically "fix" the dependencies by removing the old PHP version and installing the current one. 

The only thing you need to verify afterwards is that the corresponding mod_php72 is installed. I've had a few occasions where all things PHP where correctly updated but left the "old" mod_php* in place.


----------



## anlashok (Feb 8, 2019)

I've been wondering for a while about this, I've got lang/php71 installed via pkg, however running `pkg upgrade` never offers to upgrade PHP 7.1 to PHP 7.2. Its been like that for me since the notice that default version of PHP changed to PHP 7.2, but several times it has upgraded to newer versions of php71 packages.

What is likely blocking the upgrade?


```
# freebsd-version
11.2-RELEASE-p9

# cat /usr/local/etc/pkg/repos/FreeBSD.conf
FreeBSD: {
url: "pkg+http://pkg.FreeBSD.org/${ABI}/latest"
}

# pkg update -f ; pkg upgrade
Updating FreeBSD repository catalogue...
Fetching meta.txz: 100%    944 B   0.9kB/s    00:01
Fetching packagesite.txz: 100%    6 MiB   1.7MB/s    00:04
Processing entries: 100%
FreeBSD repository update completed. 32083 packages processed.
All repositories are up to date.
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
Checking for upgrades (0 candidates): 100%
Processing candidates (0 candidates): 100%
Checking integrity... done (0 conflicting)
Your packages are up to date.
```

Checking installed versions of PHP says its up to date with repository

```
# pkg version -vR | grep php
mod_php71-7.1.26_1                 =   up-to-date with remote
php71-7.1.26_1                     =   up-to-date with remote
...other php extensions...
```

However this suggests that the installed version is newer than the remote version

```
# pkg version | grep php
mod_php71-7.1.26_1                 >
php71-7.1.26_1                     >
...other php extensions...
```

So I guess the indexes are out of date, yet I've wiped /usr/ports/ and downloaded a fresh copy and the issue remains.

I realise I could manually do the upgrade by removing and reinstalling, I'm just confused as to why its not working automatically.


----------



## marian78 (Feb 10, 2019)

ok, a did this>

pkg remove php70
pkg install php72-ctype php72-dom php72-gd php72-iconv php72-json php72-mbstring php72-posix php72-simplexml php72-xmlreader php72-xmlwriter php72-zip php72-zlib php72-pdo_mysql php72-curl php72-fileinfo php72-bz2 php72-intl php72-pecl-mcrypt php72-openssl php72-exif php72-pecl-redis php72-pecl-imagick php72-pcntl php72-hash php72-xml php72-session php72-mysqli php72-wddx php72-xsl php72-filter php72-opcache


installed without errors
reboot server
no page loaded in client browser (blank page)
looked to log httpd-error.log:


```
[Sun Feb 10 16:07:26.044641 2019] [mpm_prefork:notice] [pid 713] AH00169: caught SIGTERM, shutting down
[Sun Feb 10 16:09:09.005459 2019] [ssl:warn] [pid 717] AH01873: Init: Session Cache is not configured [hint: SSLSessionCache]
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20151012/session.so' - Cannot open &quot;/usr/local/lib/php/20151012/session.so&quot; in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20151012/bz2.so' - Cannot open &quot;/usr/local/lib/php/20151012/bz2.so&quot; in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20151012/ctype.so' - Cannot open &quot;/usr/local/lib/php/20151012/ctype.so&quot; in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20151012/curl.so' - Cannot open &quot;/usr/local/lib/php/20151012/curl.so&quot; in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20151012/dom.so' - Cannot open &quot;/usr/local/lib/php/20151012/dom.so&quot; in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20151012/exif.so' - Cannot open &quot;/usr/local/lib/php/20151012/exif.so&quot; in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20151012/fileinfo.so' - Cannot open &quot;/usr/local/lib/php/20151012/fileinfo.so&quot; in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20151012/filter.so' - Cannot open &quot;/usr/local/lib/php/20151012/filter.so&quot; in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20151012/gd.so' - Cannot open &quot;/usr/local/lib/php/20151012/gd.so&quot; in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20151012/hash.so' - Cannot open &quot;/usr/local/lib/php/20151012/hash.so&quot; in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20151012/iconv.so' - Cannot open &quot;/usr/local/lib/php/20151012/iconv.so&quot; in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20151012/imagick.so' - Cannot open &quot;/usr/local/lib/php/20151012/imagick.so&quot; in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20151012/intl.so' - Cannot open &quot;/usr/local/lib/php/20151012/intl.so&quot; in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20151012/json.so' - Cannot open &quot;/usr/local/lib/php/20151012/json.so&quot; in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20151012/mbstring.so' - Cannot open &quot;/usr/local/lib/php/20151012/mbstring.so&quot; in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20151012/mcrypt.so' - Cannot open &quot;/usr/local/lib/php/20151012/mcrypt.so&quot; in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20151012/mysqli.so' - Cannot open &quot;/usr/local/lib/php/20151012/mysqli.so&quot; in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20151012/openssl.so' - Cannot open &quot;/usr/local/lib/php/20151012/openssl.so&quot; in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20151012/pcntl.so' - Cannot open &quot;/usr/local/lib/php/20151012/pcntl.so&quot; in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20151012/pdo.so' - Cannot open &quot;/usr/local/lib/php/20151012/pdo.so&quot; in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20151012/posix.so' - Cannot open &quot;/usr/local/lib/php/20151012/posix.so&quot; in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20151012/simplexml.so' - Cannot open &quot;/usr/local/lib/php/20151012/simplexml.so&quot; in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20151012/xml.so' - Cannot open &quot;/usr/local/lib/php/20151012/xml.so&quot; in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20151012/xmlwriter.so' - Cannot open &quot;/usr/local/lib/php/20151012/xmlwriter.so&quot; in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20151012/zip.so' - Cannot open &quot;/usr/local/lib/php/20151012/zip.so&quot; in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20151012/zlib.so' - Cannot open &quot;/usr/local/lib/php/20151012/zlib.so&quot; in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20151012/pdo_mysql.so' - Cannot open &quot;/usr/local/lib/php/20151012/pdo_mysql.so&quot; in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20151012/redis.so' - Cannot open &quot;/usr/local/lib/php/20151012/redis.so&quot; in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20151012/wddx.so' - Cannot open &quot;/usr/local/lib/php/20151012/wddx.so&quot; in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20151012/xmlreader.so' - Cannot open &quot;/usr/local/lib/php/20151012/xmlreader.so&quot; in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20151012/xsl.so' - Cannot open &quot;/usr/local/lib/php/20151012/xsl.so&quot; in Unknown on line 0
[Sun Feb 10 16:09:11.041467 2019] [mpm_prefork:notice] [pid 717] AH00163: Apache/2.4.38 (FreeBSD) OpenSSL/1.0.2o-freebsd configured -- resuming normal operations
[Sun Feb 10 16:09:11.041683 2019] [core:notice] [pid 717] AH00094: Command line: '/usr/local/sbin/httpd -D NOHTTPACCEPT'
[Sun Feb 10 16:09:34.397332 2019] [:error] [pid 741] [client 192.168.1.16:50019] PHP Fatal error:  Class 'PDO' not found in /usr/local/www/apache24/data/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/DriverManager.php on line 172
[Sun Feb 10 16:09:34.719458 2019] [:error] [pid 742] [client 192.168.1.16:50023] PHP Fatal error:  Class 'PDO' not found in /usr/local/www/apache24/data/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/DriverManager.php on line 172
[Sun Feb 10 16:09:34.813241 2019] [:error] [pid 742] [client 192.168.1.16:50023] PHP Fatal error:  Class 'PDO' not found in /usr/local/www/apache24/data/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/DriverManager.php on line 172
```


----------



## anlashok (Feb 10, 2019)

make sure you also install mod_php72 as well then restart, I don't see it in the list


----------



## marian78 (Feb 11, 2019)

hi,
I'm very happy, server is again online , FreeBSD is cool. 
Thanks all.

As you wrote i must do:

`pkg install mod_php72`
`pkg install php72-pecl-APCu`


----------



## gentoobob (Mar 15, 2019)

I had php5 and mod_php5 and couldn't do an upgrade.   Just removed them individually and then installed php73 and mod_php73.  It updated my configs too and all worked well.  No issues.


----------

