liveapi connections to cpsrvd are failing

stretchshock

Registered
Jun 18, 2012
3
0
1
cPanel Access Level
Root Administrator
I'm trying to play around with the cpanel liveapi for perl and I'm running into a problem with making any connection to cpsrvd to use the api. I'm just trying to run the test perl and php scripts that are provided by cpanel and the both seem to fail. As the shell output below indicates, this is all being run from /usr/local/cpanel/base/frontend/x3. This would I think appear to be a server related issue, but I'm not really sure what is broken or disabled that prevents this from running.

These are the errors I get when trying to run the perl and php scripts from shell:

[email protected] [/usr/local/cpanel/base/frontend/x3]# php test.live.php
<html>
<pre>

Fatal error: Uncaught exception 'RuntimeException' with message 'There was a problem fetching the env variablecontaining the path to the socket' in /usr/local/cpanel/php/cpanel.php:140
Stack trace:
#0 /usr/local/cpanel/base/frontend/x3/test.live.php(8): CPANEL->__construct()
#1 {main}
thrown in /usr/local/cpanel/php/cpanel.php on line 140

[email protected] [/usr/local/cpanel/base/frontend/x3]# perl test.live.pl
Wed Jun 20 19:58:16 2012 There was a problem connecting back to the cPanel engine [socket file does not exist or env not set].. Make sure your script ends with .live.pl or .LiveAPI:
Content-type: text/html

Can't call method "exec" on an undefined value at test.live.pl line 15.


I also checked and cpsrvd is also running on the server when I made these attempts:

[email protected] [/usr/local/cpanel/base/frontend/x3]# ps aux | grep cpsrvd
root 23709 0.0 0.4 15920 8580 ? S Jun19 0:00 cpsrvd (SSL) - waiting for connections
root 28504 0.0 0.0 3100 720 pts/2 R+ 20:00 0:00 grep cpsrvd

Thanks!
 

cPanelDavidN

Well-Known Member
Staff member
Dec 17, 2009
571
3
68
Houston, TX
cPanel Access Level
Root Administrator
LiveAPI scripts must be served from cpsrvd; You must load 'test.live.*' from the cPanel UI:
1) log into your cPanel account
2) once logged in, change 'index.html' in the address bar of your browser to 'test.live.php' or 'test.live.pl' and hit 'go/return'

When a document, which has the 'live.*' extension, is requested from the server (cpsrvd daemon), a private socket is opened prior to parsing and serving the doc. During processing of the document, it will load the logic necessary to connect to that socket, and do so. API calls can then pumped through the pipe. On a command line, there's no way to trigger cpsrvd to provide you that private socket to the API engine.

Regards,
-DavidN