SOLVED UAPI Add MySQL Host doesn't take effect

May 22, 2011
5
1
51
Hey Guys,

I'm developing a basic PHP script to add new hosts to the MySQL external access using the function MySQL:add_host_note. The scripts works and if I run the MySQL::get_host_notes function, the hosts which was recently added are there.
However there are two problems: if I check the hosts on cPanel page "/frontend/paper_lantern/sql/managehost.html", the hosts aren't there. And if I try a external connection to the MySQL server, it doesn't work.
I have done a test: I added a host using the function and then I ran the function MySQL::get_host_notes: the host was there; however it wasn't on "/frontend/paper_lantern/sql/managehost.html" page. So I tried connect to the server using a external network: it didn't work. To check the problem, I added the host at the "/sql/managehost.html" page: the connection has worked.

I could use the API2, but it doesn't support add notes to the host. So I would like to use the UAPI functions.
I'm using a shared hosting with cPanel 76.0.20.

Could you help me with this problem?

Thank you!
 
May 22, 2011
5
1
51
Hi @cPanelLauren !

Thank you for your reply.
Sure, I'll clarify these two questions

1 - I'm using a PHP script wich uses the CURL functions to create a cPanel Session. To add a host I access (using the CURL functions) the URL
"
Code:
https://cpaneldomain:2083/execute/Mysql/add_host_note?host=HOSTHERE&note=NOTEHERE
2 - Before adding a new host using the UAPI function "Mysql::add_host_note", the page "/frontend/paper_lantern/sql/managehost.html" is like this:


Using the API Shell to run the UAPI function "Mysql::get_host_notes", the system returns this:


So, when I run the PHP script to add a new host and use the API Shell again, the system returns this (with the new host inserted):


But the page "/frontend/paper_lantern/sql/managehost.html" still shows the same hosts as before:

- Please attach images to post. Links removed -

Besides that, the external MySQL connection doesn't work with the host recently added, unless I insert the host at the last page showed.

Thanks!
 
Last edited by a moderator:
May 22, 2011
5
1
51
Hi @cPanelLauren!

Thank you for your reply.
Sure, I'll clarify these two questions

1 - I'm using a PHP script wich uses the CURL functions to create a cPanel Session. To add a host I access (using the CURL functions) the URL
Code:
https://cpaneldomain:2083/execute/Mysql/add_host_note?host=HOSTHERE&note=NOTEHERE
2 - Before adding a new host using the UAPI function "Mysql::add_host_note", the page "/frontend/paper_lantern/sql/managehost.html" is like this:
11.png

Using the API Shell to run the UAPI function "Mysql::get_host_notes", the system returns this:
21.png

So, when I run the PHP script to add a new host and use the API Shell again, the system returns this (with the new host inserted):
22.png

But the page "/frontend/paper_lantern/sql/managehost.html" still shows the same hosts as before:
12.png

Besides that, the external MySQL connection doesn't work with the host recently added, unless I insert the host at the last page showed.

Thanks!

Moderator: please remove the previous post. Thanks
 
May 22, 2011
5
1
51
Hi guys,

Problem solved. First you have to use the function "Mysql::add_host" to add the host and then "Mysql::add_host_note" to add the note to that host.
 
  • Like
Reactions: cPanelLauren