PHP is used for the front-end, Erlang is used for Chat, Java and C++ are also used in several places (and perhaps other languages as well). Thrift is an internally developed cross-language framework that ties all of these different languages together, making it possible for them to talk to each other
This is information I found in web....
PHP, being a scripting language, is relatively slow when compared to code that runs natively on a server. HipHop converts PHP into C++ code which can then be compiled for better performance.
At the back-end, they use C, C++, Java and Python. Proxygen is a high performance C++ HTTP framework. It is a collection of C++ HTTP libraries, including an easy-to-use HTTP server.
Erlang is used to power the backend of chat service, handling more than 700 million active users. Facebook Chat system is running on ejabberd based server.
however it used over 20 million coding lines........