Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

liveapi connections to cpsrvd are failing

Discussion in 'cPanel Developers' started by stretchshock, Jun 20, 2012.

  1. stretchshock

    stretchshock Registered

    Jun 18, 2012
    Likes Received:
    Trophy Points:
    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:

    root@cpaneldev [/usr/local/cpanel/base/frontend/x3]# php

    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/ CPANEL->__construct()
    #1 {main}
    thrown in /usr/local/cpanel/php/cpanel.php on line 140

    root@cpaneldev [/usr/local/cpanel/base/frontend/x3]# perl
    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 or .LiveAPI:
    Content-type: text/html

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

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

    root@cpaneldev [/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

  2. cPanelDavidN

    cPanelDavidN Integration Developer

    Dec 17, 2009
    Likes Received:
    Trophy Points:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    LiveAPI scripts must be served from cpsrvd; You must load '*' 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 '' or '' 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.

    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice