How do I fix this? I replaced with longer screws but they still won't hold.
It seems to be there's a hollow space behind the framing of the door where it was screwed in till now. , so a longer screw will probably not help.
Either replace that piece of wood holding the door, or
Try packing the holes with toothpicks (and wood glue if you have) then screwing it back in.
Toggle bolt?! Got to be creative. Good luck.