Hello all,
I am very new using the cpanel/whm APIs and I am having an issue just getting the library to load.
Here is the basic code I am trying:
But it only returns an error 500 and this is the error log:
I would really like to use the built-in PHP class rather than rely on curls to the cpanel session URL stuff as this is way cleaner for what I will end up needing to do for managing FTP accounts automatically.
Thanks,
Kyle
Edit: As of right now, this is the only solution I've found even though its not ideal: N1ghteyes/cpanel-UAPI-php-class
I am very new using the cpanel/whm APIs and I am having an issue just getting the library to load.
Here is the basic code I am trying:
Code:
<?php
include("/usr/local/cpanel/php/cpanel.php");
$cpanel = new CPANEL(); // Connect to cPanel - only do this once.
// Create a new FTP user.
$new_ftp = $cpanel->uapi(
'Ftp', 'add_ftp',
array(
'user' => '[email protected]',
'pass' => '1234567890qwertyuiopxx',
'quota' => '100',
)
);
Code:
[08-Jan-2020 09:29:41 UTC] PHP Fatal error: Uncaught Error: Class 'CPANEL' not found in /home/xxxxxxxxxx/ftp_account_test.php:4
Stack trace:
#0 {main}
thrown in /home/xxxxxxxxxx/ftp_account_test.php on line 4
[08-Jan-2020 09:36:48 UTC] PHP Fatal error: Uncaught RuntimeException: There was a problem fetching the env variablecontaining the path to the socket in /usr/local/cpanel/php/cpanel.php:146
Stack trace:
#0 /home/xxxxxxxxxx/ftp_account_test.php(4): CPANEL->__construct()
#1 {main}
thrown in /usr/local/cpanel/php/cpanel.php on line 146
Thanks,
Kyle
Edit: As of right now, this is the only solution I've found even though its not ideal: N1ghteyes/cpanel-UAPI-php-class
Last edited: