phphadoophiveqlhadoop-plugins

Connect to hiveserver2 using PHP


I need to create a report in my PHP application using the data in Hadoop. I have installed hiveserver2 in my local machine. I tried to find a way to connect to hiveserver2 from my PHP code using following samples.

  1. https://github.com/QwertyManiac/hive-hs2-php-thrift
  2. https://github.com/dryangkun/php-hiveserver2

But any of them did not work for me. I have changed the configurations of the hive-site.xml as mentioned in 1st link as below.

<property>
<name>hive.server2.authentication</name>
<value>NOSASL</value>
<description>
  Expects one of [nosasl, none, ldap, kerberos, pam, custom]

I'm getting following error when I run the PHP file in 1st link.

Uncaught exception 'Thrift\Exception\TTransportException' with message 'TSocket: timed out reading 4 bytes from localhost:10000' in /Users/lazhcm10385/projects/hive/hive-hs2-php-thrift/thrift/Thrift/Transport/TSocket.php:274

Please help me if some one have proper documentation to connect to hiveserver2 using PHP.


Solution

  • I could connect to hive server from php with using https://github.com/QwertyManiac/hive-hs2-php-thrift. I closed the terminal and opened again after changing the configuration of hive server and then started the server using newly opened terminal.