0

Hi I developed a php website with mysql. It worked perfectly on localhost. I hosted my site and change database config file,

<?php 
    define("dbhost", "128.199.145.183");
    define("dbuser", "root");
    define("dbpass", "xxxxxxx");
    define("dbname", "database");

    $dbc = new mysqli(dbhost,dbuser,dbpass,dbname);

 ?> 

But it not worked. My site is working fine and when i tried to login i got an HTTP 500 error. How can i solve this?

7
  • You only use an IP address in rare circumstances, like if you're connecting to another site's host. You still use localhost on a live server. localhost simply means it's connecting to the site it's being hosted on. Commented Jul 11, 2016 at 7:58
  • @awl19 is sort of right, but plenty of shared hosts give you a different database server to localhost. Ultimately, check with your host. Also, what do your error logs say? 500 errors are internal, meaning it's a problem your side, so there will be errors logged to check. Commented Jul 11, 2016 at 8:00
  • Thanks you all. I checked error log and it says [11-Jul-2016 07:08:45 UTC] PHP Warning: PHP Startup: Unable to load dynamic library 'c:/wamp/bin/php/php5.5.12/ext/php_intl.dll' - The specified module could not be found . How to install it? Commented Jul 11, 2016 at 8:12
  • That means that problem is a missing PHP library, and it's not your mysql-connection. Google on how to enable PHP Intl on Windows. Commented Jul 11, 2016 at 8:13
  • that's warning, shouldn't be any issue. @MagnusEriksson Commented Jul 11, 2016 at 8:15

1 Answer 1

1

root database user doesn't have by default access to access database remotely.

you can verify this by looking at the mysql.user table

use mysql;
select * from user;

check if root has the ip access from %

I would recommend, create another user with limited rights on host as % (can access database remotely)

You can create user like this:

use mysql; 
create user testing@'%' indentified by 'testing_password';
grant all on *.* to testing; // you can specify databases or specific permissions
flush privileges;
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.