Support Questions
Find answers, ask questions, and share your expertise
Check out our newest addition to the community, the Cloudera Innovation Accelerator group hub.

Hive_PHP | How to connect HiveServer2 with PHP, using Thrift ?



I have 4 node HDPcluster . In that second node I installed Hiveserver2 and apache lamp server.

I want to connect HiveServer2 to PHP. Is there any way to connect. I tried but unable to resolve the issue.

Could anybody suggest any idea or blog.



@Surendra Shringi

You can use ODBC to connect to hiveserver2 with php. You can download and install the odbc client and then use the dbc connect for php:


Hi thanks for quick reply @Felix Albani

I tried but i didn't find out any way to connect. I am getting below error.

Opened transport
Fatal error: Uncaught exception 'Thrift\Exception\TApplicationException' with message 'Invalid method name: 'OpenSession'' in /var/www/html/hs2/hive/org/apache/hive/service/cli/thrift/TCLIService.php:89 Stack trace: #0 /var/www/html/hs2/hive/org/apache/hive/service/cli/thrift/TCLIService.php(56): org\apache\hive\service\cli\thrift\TCLIServiceClient->recv_OpenSession() #1 /var/www/html/hs2/HS2Client.php(40): org\apache\hive\service\cli\thrift\TCLIServiceClient->OpenSession(Object(org\apache\hive\service\cli\thrift\TOpenSessionReq)) #2 {main} thrown in /var/www/html/hs2/hive/org/apache/hive/service/cli/thrift/TCLIService.php on line 89

Could you pls let me know any solution.