facebook didn't become popular because it had technical abilities or qualities that no other companies had. i mt became popular because of good product features and good marketing ( in the most general sense). So, to them, using a bad technology wasn't such a big deal.
it doesn't mean php is good, it just means that some businesses can afford a bad technological stack. Even online ones.
now, as software developpers, we should try to use the best technology whenever we can ( with best being relative to the business constraints of course).
But commercial success and technological achievments are two different things. sometimes they're linked (think whatsapp), sometimes not.
It is extremely rare that an internet company fails because of their technology choices. At the end of the day - the user does not care about your technology. They only care about the user experience and the value your product delivers.