It depends on the visa you have and the time you have in the UK, generally you have to have lived in the UK for at least five years continuously before you can apply for ILR. You must also meet other criteria, such as passing the Life in the UK Test, as well as must be able to prove that you are of good character and financially stable. You can find more information on the UK government website here.