I want to crop a circle image using PHP but it seems that my new image have some transparent pixels. Of course, I want ONLY the outside area of the ellipse to have backgroun
You are cropping and removing black color ( or setting black as transparent ). Since your image has black color in it, it also gets removed.
Instead of removing the color, try to replace the outer layers color to, ie, pink and then set it to transparent.