Using PHP to create Mysql databases issue

Peter Sampson

Registered
Aug 21, 2018
1
0
1
Indianapolis, IN
cPanel Access Level
Root Administrator
I have been using xlmapi.php to create Mysql databases and users through PHP when my system creates a new user in my application. When I person signs up for the service, they are automatically created a Mysql user and database based on the username that they choose to use in the system. However, something on my service updated last night and now that is broken and no new users are being created. I also was using the same script to delete the database when a user leave the service and that script is no longer working either.

It looks like xmlapi.php hasn't been updated in a little while. Does anyone have anything new that they use for something like this.

I tried a few things with LiveAPI with cPanel and I just get an error stating

"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:146
Stack trace: #0 /usr/local/cpanel/base/frontend/paper_lantern/test.livephp(4): CPANEL->__construct() #1 {main} thrown in /usr/local/cpanel/php/cpanel.php on line 146"

I appreciate your thoughts and suggestions.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,909
2,225
463
Hi Peter,

It looks like xmlapi.php hasn't been updated in a little while. Does anyone have anything new that they use for something like this.
Support for the XML-like output of our API was removed from the product in cPanel & WHM version 74:

Removed XML output in API functions
In cPanel & WHM version 74, we removed the Extensible Markup Language (XML) output format from all of our API functions. We previously deprecated XML output in cPanel & WHM version 66.

Important:

You must use the JSON return format when you call API functions.
You must update your scripts to use the JSON output format to call WHM API and cPanel API functions.
If you'd like to develop PHP scripts that make use of UAPI or cPanel API 2 functions, then you'll need to use a different PHP client class. Here's a user-submitted PHP client class for UAPI that should help you get started:

N1ghteyes/cpanel-UAPI-php-class

I tried a few things with LiveAPI with cPanel and I just get an error stating
The LiveAPI System provides environments for applications in the cPanel interface. It's not designed to work with Apache and PHP in scripts uploaded to your website.

Thank you.