0

I am trying to create a database in cpanel using the folowing comment

$result =file_get_contents("http://$cpanel_user:$cpanel_password@$cpanel_host:2082/frontend/$cpanel_skin/sql/adddb.html?db=$db_name")

echo $result;

this command gives me HTTP request failed! HTTP/1.1 401 Access Denied error. I have used the correct password and username for connecting. And i am able to create the database when i give this url(url in this format) in a browsers url field.

Can someone explain what seems to be the problem?

Mihai Iorga
  • 39,330
  • 16
  • 106
  • 107
Sanjay
  • 51
  • 3
  • 6

1 Answers1

1

That is not the correct way to create databases using cPanel. I believe you are trying to replicate the form inside cPanel to create databases, which is not correct.

Also, you will not be able to create databases using your cPanel username and password. I think you should refer to this thread to resolve your issue.

automaticAllDramatic
  • 2,025
  • 1
  • 21
  • 25