Calling Cpanel UAPI method -


i have following simple script list ftp accounts unable work have following error tries call constructor

 include '/usr/local/cpanel/php/cpanel.php'; $cpanel = new cpanel(); // connect cpanel - once.  // list ftp account information. $list_ftp_accts = $cpanel->uapi('ftp', 'list_ftp'); echo "<pre>"; print_r($list_ftp_accts); 

fatal error: uncaught exception 'runtimeexception' message 'there problem fetching env variable containing path socket' in /usr/local/cpanel/php/cpanel.php:146 stack trace: #0 /public_html/uapi.php(4): cpanel->__construct() #1 {main} thrown in /usr/local/cpanel/php/cpanel.php on line 146

line 146 in cpanel.php

$socketfile = getenv('cpanel_phpconnect_socket'); 

according a post on cpanel forums, can use liveapi within cpanel's document root, meaning code need in either /usr/local/cpanel/base/frontend/ or /usr/local/cpanel/base/3rdparty/. ran while trying use in whm plugin (which reside in /usr/local/cpanel/whostmgr/docroot/), , apparently causes same problem. if you're trying run within cpanel or whm, this page has debugging steps can try walking through.

if you're trying run code on different server or within normal website's hosting account, you'll need use different interface, such xml or json api. these unfortunately confusingly documented, guide whm api 1 page should started.


Comments

  1. you are a copy cat , this is just coppied and pasted from many sites

    ReplyDelete

Post a Comment

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -

Python Pig Latin Translator -