by Ken Task.
@Malik
Suggest try running the php command to upgrade.php without using sudo (ie, under apache user).
cd sitefolder/admin/cli/;
php upgrade.php (this will be interactive and you will have to respond to prompts)
Just make note of files/folders ownerships and permissions before running the command. You might have to reset those.
'spirit of sharing', Ken