"You will not be able to apply if you came to the UK as a visitor with permission to stay for 6 months - you must leave the UK and apply from your country of residence.
If entered the UK in a different immigration category and you have been given permission to live here for a total of more than 6 months since your most recent admission to the UK. For example, you can switch if we gave you a 3-month visa and then permission to remain for 5 months, totalling 8 months. Your current permission must have been given in accordance with the Immigration Rules, not 'exceptionally' (outside the Immigration Rules)."