jameswilson
What is the best way. Will php5 cgi cause a conflict. SHould i remove the contribs first etc etc?
If you intend to continue using the current hardware, just do a upgrade. It's the easiest and least hassle way.
I recommend you uninstall any incompatible contribs before upgrading, which includes php5-cgi. That has always been the case between version upgrades of sme server for the last 12 years or more.
Always do a backup before any major upgrade, and verify your backup to ensure it is good. It is also wise to test your complete backup and restore procedures so in the event of a worst case scenario developing, then you know "for sure" that your backup is good and that it will restore correctly. Many people have had their fingers burnt (and lost data) by backups that would not restore correctly. Use a test server to do a test restore, or just temporarily reconfigure your main server with another drive, if you can tolerate some down time.
I think I read somewhere that php5-cgi contrib will be automatically uninstalled during an upgrade to sme8, but not 100% sure about that.
You could read the migrate/upgrade code if you know how, to see what happens during an upgrade, or search these forums or bugzilla or the dev mailing lists
You should really fix that php5-cgi security issue immediately, your server may already be hacked !
See
http://forums.contribs.org/index.php/topic,48612.0.html