user21209: I've only heard PHP is terrible (e.g. in the context of Mt. Gox) and a more efficient/more security-oriented language would be preferable for matching orders and account security. Which programming language, and due to what reasons, would be better?

user20727: TL;DR I would use Scala, F# or Rust. If you don't like FP, then Java/C#. 
Statically typed: The reason I would avoid Php, and most other dynamically typed languages, is to avoid bugs. Dynamically typed langs are easy to learn and code, but a statically typed lang like Java / C# will avoid a certain kind of bugs, and make refactoring easier.
Automatic memory management: I would also avoid langs where you manage memory, like C/C++, mostly because I fear bugs. Remember Heartbleed? That category of bugs can only happen when the programmer manages memory. Rust/Go are better.
Functional: I know that FP is considered hard, but it is a way to avoid bugs, especially if you are running a multithreaded app where the threads communicate with each other (like trading). FP's most important feature is that you work with immutable data structures. Functional langs are Haskell, F#, Scala and Erlang.

user-1: There is no possible way of knowing what are the technologies used by the exchanges. 
C++, C# and C have been typically used by the financial and trading software industry as they can be optimized for low latency / high frequency behavior needed for real-time trading. Java, F#, Python, VBA, Haskell as well as other programming languages have also been used but it all comes to a matter of a personal taste, what technologies you or your team are familiar with, what open source (or not) modules are out there that will prevent you from reinventing the wheel and much more that are out of the context of this forum. 
Another way to get an idea for the technologies used by an exchange is to spy on its job adverts. Still, what you'll get might not be accurate or it might refer to another or new product or service of that exchange, or even a migration of the existing technologies towards some other but still you'll get an idea. 

user5464: A lot of financial industry prefers Python. Some remarkable Bitcoin exchanges, like Bitstamp and LocalBitcoins are built on the top of Python and Django web framework (though there exist other web frameworks you might want to use).
The reasons to choose Python include

Open source ecosystem with a lot of modules to choose from, like ones for Bitcoin
It is not only web development language, but has large use base in scientific computing, making it ideal for data analysis and number crunching (see e.g. IPython, NumPy projects). This makes Python different from Ruby, which is more heavily web only.
Python applications have very good security track record, compared to e.g. PHP applications. To confirm this, see CVE entries to the programming language, related frameworks (Python, PHP)
Unlike more static languages, like Java and C#, which optimize CPU-bound performance, Python optimizes development time, making it very productive. You can always port your code to more heavy platform if your service grows popular and you have money to spend. This is especially important if your project is not backed up by a big corporation, but more startup oriented.


21209: <p>I've only heard PHP is terrible (e.g. in the context of Mt. Gox) and a more efficient/more security-oriented language would be preferable for matching orders and account security. Which programming language, and due to what reasons, would be better?</p>
 20727: <p>TL;DR I would use Scala, F# or Rust. If you don't like FP, then Java/C#. </p>

<p>Statically typed: The reason I would avoid Php, and most other dynamically typed languages, is to avoid bugs. Dynamically typed langs are easy to learn and code, but a statically typed lang like Java / C# will avoid a certain kind of bugs, and make refactoring easier.</p>

<p>Automatic memory management: I would also avoid langs where you manage memory, like C/C++, mostly because I fear bugs. Remember Heartbleed? That category of bugs can only happen when the programmer manages memory. Rust/Go are better.</p>

<p>Functional: I know that FP is considered hard, but it is a way to avoid bugs, especially if you are running a multithreaded app where the threads communicate with each other (like trading). FP's most important feature is that you work with immutable data structures. Functional langs are Haskell, F#, Scala and Erlang.</p>
 -1: <p>There is no possible way of knowing what are the technologies used by the exchanges. </p>

<p>C++, C# and C have been typically used by the financial and trading software industry as they can be optimized for low latency / high frequency behavior needed for real-time trading. Java, F#, Python, VBA, Haskell as well as other programming languages have also been used but it all comes to a matter of a personal taste, what technologies you or your team are familiar with, what open source (or not) modules are out there that will prevent you from reinventing the wheel and much more that are out of the context of this forum. </p>

<p>Another way to get an idea for the technologies used by an exchange is to spy on its job adverts. Still, what you'll get might not be accurate or it might refer to another or new product or service of that exchange, or even a migration of the existing technologies towards some other but still you'll get an idea. </p>
 5464: <p>A lot of <a href="http://www.slideshare.net/PyData/python-in-the-financial-industry-felix-fernandez" rel="nofollow">financial industry</a> prefers <a href="http://python.org/" rel="nofollow">Python</a>. Some remarkable Bitcoin exchanges, like Bitstamp and LocalBitcoins are built on the top of Python and <a href="https://www.djangoproject.com/" rel="nofollow">Django</a> web framework (though there exist other web frameworks you might want to use).</p>

<p>The reasons to choose Python include</p>

<ul>
<li><p>Open source ecosystem with a lot of modules to choose from, like <a href="https://github.com/vbuterin/pybitcointools" rel="nofollow">ones</a> for Bitcoin</p></li>
<li><p>It is not only web development language, but has large use base in scientific computing, making it ideal for data analysis and number crunching (see e.g. <a href="http://ipython.org/" rel="nofollow">IPython</a>, <a href="http://www.numpy.org/" rel="nofollow">NumPy</a> projects). This makes Python different from Ruby, which is more heavily web only.</p></li>
<li><p>Python applications have very good security track record, compared to e.g. PHP applications. To confirm this, see CVE entries to the programming language, related frameworks (<a href="http://www.cvedetails.com/product/18230/Python-Python.html?vendor_id=10210" rel="nofollow">Python</a>, <a href="http://www.cvedetails.com/product/128/PHP-PHP.html?vendor_id=74" rel="nofollow">PHP</a>)</p></li>
<li><p>Unlike more static languages, like Java and C#, which optimize CPU-bound performance, Python optimizes development time, making it very productive. You can always port your code to more heavy platform if your service grows popular and you have money to spend. This is especially important if your project is not backed up by a big corporation, but more startup oriented.</p></li>
</ul>
