-3

The credentials are working from mysql workbench, but when I try it from PHP it takes a lot of time loading then gives 500 - internal server error.

$DB_HOST = some ip here (NOT localhost or 127.0.0.1) ;
$DB_USER = "myuser";
$DB_PASS = "mypassword";
$DB_NAME = "mydb";

$db = mysql_connect($DB_HOST, $DB_USER, $DB_PASS);

mysql_select_db($DB_NAME,$db) or  die("Error In database");

This was working on the dev server, but when moved to a new server it doesnt.

it might be useful to mention that the server runs PHP 5.4 so mysql_connect works fine.

I appreciate if you can help.

Digital fortress
  • 737
  • 8
  • 18
  • 31

1 Answers1

0

if you use cpanel as your hosting, you have to set database user in MYSQLDATABASE menu then you have to use prefix in DBUser and DBName like 'user_table' and 'user_db'