# Updating packages with portupgrade



## c00kie (Jul 7, 2012)

hi

I have a FAMP on my VPS and am trying to upgrade installed packages (PHP, MySQL & Apache); since some of them are getting a little older. I've chosen the portupgrade utility since the manual recommends this.

With portupgrade installed succesfully, upon:

`#  portupgrade -a`

I receive:


```
** Fix the problem and try again.
** Listing the failed packages (-:ignored / *:skipped / !:failed)
	! www/php5-session (php5-session-5.3.11)	(compiler error)
	! databases/php5-mysql (php5-mysql-5.3.11)	(missing header)
	! databases/php5-mysqli (php5-mysqli-5.3.11)	(missing header)
```



The majority of my packages are now updated successfully, but the most important, namely the above are not! That is, I'm still on PHP 5.3






What's the problem?


----------



## Dies_Irae (Jul 7, 2012)

Have you updated the ports tree prior to run portupgrade(1)?

`# portsnap fetch update`


----------



## wblock@ (Jul 7, 2012)

Always, yes always, read /usr/ports/UPDATING before blindly running portupgrade or portmaster -a.


----------



## c00kie (Jul 8, 2012)

Dies_Irae said:
			
		

> Have you updated the ports tree prior to run portupgrade(1)?
> 
> `# portsnap fetch update`



Hi

I originally did a 
`# portsnap update`

but since you point out

`# portsnap fetch update`

I've since used your command. But still after running:

`# portupgrade -a`


I receive:



```
Stop in /usr/ports/www/php5-session.
** Command failed [exit code 1]: /usr/bin/script -qa /tmp/portupgrade20120708-9098-1vp3m2m-0 env UPGRADE_TOOL=portupgrade UPGRADE_PORT=php5-session-5.3.11 UPGRADE_PORT_VER=5.3.11 make
** Fix the problem and try again.
** Listing the failed packages (-:ignored / *:skipped / !:failed)
	! databases/php5-mysqli (php5-mysqli-5.3.11)	(missing header)
	! databases/php5-mysql (php5-mysql-5.3.11)	(missing header)
	! www/php5-session (php5-session-5.3.11)	(compiler error)
```



I don't understand?


----------



## c00kie (Jul 8, 2012)

wblock@ said:
			
		

> Always, yes always, read /usr/ports/UPDATING before blindly running portupgrade or portmaster -a.



hi

Indeed, http://www.freshports.org/lang/php5/ was one of the first documents I looked at:

These upgrade notes are taken from /usr/ports/UPDATING

    2012-05-16

    Affects: users of lang/php5

    Author: ale@FreeBSD.org

    Reason: 
      PHP has been updated to 5.4. Suhosin patch has been disabled until the
      new version will be released (soon). Suhosing extension will take more
      time. LINKTHR option is now enabled by default, be sure to flag it if
      you are updating using an old saved configuration. sqlite2 extension
      has been permanently removed.
      If you want to remain at PHP 5.3, a new port (lang/php53) has been
      created for such purpose.


I don't see any issues, or am I missing something?


----------



## c00kie (Jul 8, 2012)

Things go from bad to worse:


On one of my virtual domains I browse to http://mydomain.com and all I see is 

"Error establishing a database connection". Further more, at the shell:


`#  mysql -u root -p`

```
Enter password: 
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
```

Running 
	
	



```
<?php phpinfo(); ?>
```
 under the above domain reports that mysqli support is active.



I haven't lost anything important thankfully, but sure am learning the hard way fast...

Am I going to have to start re-installing mysql packages?


----------



## robbak (Jul 8, 2012)

All the error messages you have provided tell us "something went wrong". Near the end of the output will be the actual error message.

Look back until you can find the first error. Provide us with that, and we might have a chance. It is probably a case of an incorrectly installed port or a missing file, but we need more info.


----------



## c00kie (Jul 8, 2012)

OK, steps I've taken.

I've remove packages:


```
php5-mysql-5.3.11                   <   needs updating (port has 5.4.4)
php5-mysqli-5.3.11                  <   needs updating (port has 5.4.4)
php5-session-5.3.11                 <   needs updating (port has 5.4.4)
```

And the "Error establishing a database connection" is no longer. Obviously since I've deleted the database.



My ports tree is up-to-date. Focusing on PHP for a moment:

`# pkg_version -v` reports


```
php53-5.3.14                        =   up-to-date with port
```

but the most up-to-date version of PHP is 5.4?

I try 

`#  portupgrade -R php53-5.3.14`

```
[Gathering depends for lang/php53 ....................... done]
[Exclude up-to-date packages ............. done]
```

but after running `# pkg_version -v`

I'm still seeing


```
php53-5.3.14                        =   up-to-date with port
```

I'm expecting to see an entry for php54?


----------



## wblock@ (Jul 8, 2012)

Reread the portupgrade man page.  -R means rebuild everything that this port depends on.


----------



## c00kie (Jul 8, 2012)

wblock@ said:
			
		

> Reread the portupgrade man page.  -R means rebuild everything that this port depends on.



Thanks

My steps:

Ports tree is up-to-date.


`# portupgrade -a`

Reports no errors - in fact returns me back to the prompt so am assuming everythings OK.
`# pkg_version -v`

Returns:


```
php53-5.3.14                        =   up-to-date with port
```
Should this not now be php54?


----------



## kpa (Jul 8, 2012)

lang/php5 is PHP 5.4 and lang/php53 is PHP5.3 for those who want to stay at version 5.3.


----------



## wblock@ (Jul 8, 2012)

c00kie said:
			
		

> `# pkg_version -v`
> 
> Returns:
> 
> ...



No:

```
% ls -d /usr/ports/lang/php5*
/usr/ports/lang/php5
/usr/ports/lang/php5-extensions
/usr/ports/lang/php52
/usr/ports/lang/php52-extensions
/usr/ports/lang/php53
/usr/ports/lang/php53-extensions
```

PHP 5.4 is a different port, lang/php5.  So you have the latest version of lang/php53.  To switch to the main port, use the -o option to portupgrade or portmaster.  (Untested, there may be other complications in dependent ports.)


----------



## c00kie (Jul 8, 2012)

thanks.

Now 

`# portupgrade -o php5-5.3.8`
Reveals:

```
[Updating the pkgdb <format:bdb_btree> in /var/db/pkg ... - 34 packages found (-1 +2) (...).. done]
[Updating the portsdb <format:bdb_btree> in /usr/ports ... - 23751 port entries found .........1000.........2000.........3000.........4000.........5000.........6000.........7000.........8000.........9000.........10000.........11000.........12000.........13000.........14000.........15000.........16000.........17000.........18000.........19000.........20000.........21000.........22000.........23000....... ..... done]
** Port directory not found: php5-5.3.8
** Listing the failed packages (-:ignored / *:skipped / !:failed)
	- php5-5.3.8 (port directory error)
```

But from `# pkg_info`


```
php53-5.3.14        PHP Scripting Language
```

What is a port directory error?


----------



## wblock@ (Jul 8, 2012)

In this case, it means "that is not how that option is used".  See the portupgrade man page.


----------

