Some notes:
1. C++ is not best because it has "proper linked lists and all". If you want to use proper data structures and find them lacking in PHP, dont use PHP. Use Java. Use Ruby. Use Python. But most of all, I'd suggest use PHP the way PHP is meant to be used. Use the link Vidit emailed.
2. exec() is not the right way to call C++ from PHP. Look at writing php modules in c++. It is not the most trivial of things. Tutorial:
http://devzone.zend.com/303/extension-writing-part-i-introduction-to-php-and-zend/
3. Thrift is an alternative to JSON in ajax (in its simplest form). Its a fast data serialization and de-serialization library, with interface definition and code generation tools to help you use the framework for cross platform development with ease (cross platform = not just limited to web apps/ajax).
Harshath
+91-767675-4811