Just a little follow on form my earlier bit of un-planned down time. The reason for the downtime was that I ran into three problems while upgrading the php5-cgi port. In this post I’m going to detail the solutions, mainly so I have easy access to them next time I upgrade PHP5 on a FreeBSD machine, but also because this may be of some use to someone somewhere some time.

[tags]FreeBSD, PHP5[/tags]

The first pitfall I hit was not realising that upgrading php5-cgi with the command portupgrade -R will NOT also upgrade the other php5 modules you have installed like php5-session etc.. What happens is that php5-cgi builds and all looks well until you try to access a php page and you get a HTTP 500 error. This happens because the new php-cgi won’t find the .so files for the old versions of the php modules. To fix this you have to go to the port for each of your php modules and do a make reinstall. If you’re under stress and accidentally do make clean followed by make install instead you’ll create a new problem for yourself. That causes duplicate entries in /usr/local/etc/php/extensions.ini which will also cause HTTP 500 errors. And yes, I did find this out the hard way earlier today 🙂

Finally, for some strange reason upgrading php5-cgi resulted in the simlink /usr/local/www/cgi-bin/php pointing to the wrong file in /usr/local/bin. That simlink should look like the following or you’ll get HTTP 500 errors:

lrwxr-xr-x  1 root  wheel   22 Mar 29 15:53 php -> /usr/local/bin/php-cgi

It should NOT look like this:

lrwxr-xr-x  1 root  wheel   22 Mar 29 15:53 php -> /usr/local/bin/php