Do I change anything on a real server?

I just uploaded my website to a real hosting server
Here are server and DB settings:

$db_host = 'localhost';
$db_name = 'tex2022';
$db_user = 'root';
$db_password = '';
  1. what should be instead of ‘localhost’ ? The name server ? anything else ?
  2. should I change $db_user and $db_password ?

If yes, Where do I change them in phpmyadmin ?

Here is the error mode settings:


On a read hosting server, should I change to ERRMODE_SILENT ?

I read once that it is unsafe to display errors to everyone

This is information you need to get from your hosting provider. If they have some kind of control panel to manage your account, the information might be in there. Otherwise, contact their customer service and ask.

No. You should leave the error mode set to exceptions.

It is, but you shouldn’t have code that unconditionally displays the raw database errors.

You should only catch and handle database exceptions in your code for user recoverable errors, such as when inserting/updating duplicate or out of range data, where you would test the error number in the exception handling and setup a helpful message for the user letting them know what was wrong with the data that they submitted. For all other error numbers, just re-throw the exception and let php handle it. For all other cases, do nothing in your code and let php catch and handle the database exceptions, where php will display or log the actual error information, the same as php errors. On a live/public server, you would log all php errors, which would now include the raw database errors.

1 Like

If it were me then I would look for information from the hosting provider, as Kicken said. I would do that before uploading my website. They probably have some samples. I would try to interact with a database in a simple site, just to learn how things work. Probably what you have already uploaded can be left and used when you are ready to but if possible it would probably help to create something simple to learn from.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.