I put up some IKEA cabinets (using their suspension rail). I used a 5mm (#10) x 50mm (2 inch). Minus the drywall and rail it probably went in about 35-40mm (1.5 inch) into the stud.
After all was said and done, I realized that the screws didn't need to be that long (or thick). I understand now that by using longer screws it increases the chance to hit wires or pipes running through a stud. However, I don't think there are any pipes or wires in the wall where I drilled. Given that I didn't hit any pipes or wires, is there any concern that the larger screws I used could weaken the stud or foundation?