O'Reilly logo

Learning Apache Thrift by Krzysztof Rakowski

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Implementing and running clients

As the server is running, we now need to implement the clients. You should be familiar with this part, so I will just remind you of the most important parts, leaving something for you as homework.

Creating a client in PHP

When creating the client in PHP, we go through the standard procedure of including the required files, registering namespaces, and creating the connection:

#!/usr/bin/env php <?php define('THRIFT_PHP_LIB', __DIR__.'/thrift-0.9.2/lib/php/lib'); define('GEN_PHP_DIR', __DIR__.'/gen-php'); require_once THRIFT_PHP_LIB.'/Thrift/ClassLoader/ThriftClassLoader.php'; use Thrift\ClassLoader\ThriftClassLoader; $loader = new ThriftClassLoader(); $loader->registerNamespace('Thrift', THRIFT_PHP_LIB); // register ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required