# Upgrade PHP from 5.5 to 5.6 (originally installed with portmaster)



## Aknot (Sep 28, 2016)

*Hello,*

As PHP 5.5 is going to be deprecated soon, we need to upgrade PHP to version 5.6.
I't a straight forward 10.3-RELEASE-p9 with Apache 2.4 and MySQL.

All ports are installed using portmaster.
Someone told me to just run:

`portmaster -o lang/php56 lang/php55`

Could anything really be that easy?
Or are there any known "heads up"?

*Using the following PHP Modules*


```
bz2
Core
ctype
curl
date
dba
dom
ereg
exif
fileinfo
filter
ftp
gd
gettext
hash
iconv
intl
json
libxml
mbstring
mcrypt
mhash
mysql
mysqli
mysqlnd
openssl
pcre
PDFlib
PDO
pdo_mysql
pdo_sqlite
Phar
posix
pspell
readline
Reflection
session
SimpleXML
soap
SPL
sqlite3
standard
tokenizer
xml
xmlreader
xmlwriter
xsl
Zend OPcache
zip
zlib

[Zend Modules]
Zend OPcache
```


----------



## SirDice (Sep 28, 2016)

That should work, but I like to go with a less error prone solution, just remove everything PHP 5.5 related and install PHP 5.6 with the modules you need. There's less risk of running into a dependency hell if you remove the old stuff first. It's a bit more work though.


----------



## Aknot (Sep 28, 2016)

Perfect, as I thought! 

If I may ask two more questions:
1. Should ports originally installed with portmaster, be uninstalled with `cd /usr/ports/lang/php55 && make deinstall clean`, or should we use portmaster for uninstalling?
2. Is there a way to deinstall all of php55 modules in one go, or do we need to deinstall them one by one?

Thanks,


----------



## SirDice (Sep 28, 2016)

1) Doesn't matter, it'll all end up doing a pkg-delete(8).

2) This should probably remove it all: `pkg delete -R php55 && pkg autoremove`


----------



## Remington (Sep 28, 2016)

Other option is to compile PHP sources directly from php.net which I normally do and its easier to maintain.

https://forums.freebsd.org/threads/57420/#post-328807


----------



## SirDice (Sep 28, 2016)

Remington said:


> Other option is to compile PHP sources directly from php.net which I normally do and its easier to maintain.


Not recommended unless you really know what you are doing. I would advise against it and sticking to either ports or packages, use the ports if you're going to deviate from the standard settings.


----------



## Remington (Sep 28, 2016)

SirDice said:


> Not recommended unless you really know what you are doing. I would advise against it and sticking to either ports or packages, use the ports if you're going to deviate from the standard settings.



Been doing it for 2 years and had no issues but you are correct that is not something for someone who knows nothing about manually compiling source codes.  I did this because I have multiple PHP versions and to keep pkg list short as well.


----------



## Aknot (Oct 23, 2016)

SirDice said:


> 1) Doesn't matter, it'll all end up doing a pkg-delete(8).
> 
> 2) This should probably remove it all: `pkg delete -R php55 && pkg autoremove`



Worked like a charm! Thanks!


----------

