It’s common in a website development area to deal with errors that you sometimes don’t know. This is why it’s extremely useful to have a feature that lets you find a solution based on the information that you already have.
How can I enable the error messages?
Access your Hostinger account and navigate through Hosting → Manage → Advanced session → PHP Configuration:
Now navigate to the PHP options tab and enable one of these options:
- Log_errors: To save your website error messages inside a file named error_log in your public_html (root) folder.
- Display_errors: The error message will be shown online on your website page as soon as you trigger it.
Once done, your changes, and access to your website again, you will notice that you have an error message to work on.
How can I fix the error?
- Make sure that the scripts were uploaded in the correct mode - ASCII or Binary. Check the readme of your script to see any special instructions. Normally it should be ASCII.
- Check permission (chmod) values of the file or directory. The recommended permissions are 755 for folders and 644 for files.
- If you've added some additional configurations to your .htaccess file, make sure to double-check it and ensure that it doesn't contain any errors. To confirm whether it's an issue with the .htaccess file, just rename the .htaccess file but be sure to make backups of it.
- Prevent your PHP code from timing out. To do that we suggest that your relevant PHP scripts be coded with some timeout rules.
- And the most important tip, search on Google for your script name + internal server error or website builder + error message. Most likely, someone already had the same issue and explained a solution online, e.g WordPress error establishing a database connection.
Also, you can take a closer look at the error code, fixing the source reason might solve your issue without restoration from backup:
- Call to undefined function means that in some file the website is trying to call the function that was not defined properly yet. It usually happens when an incorrect PHP version is chosen, try changing the PHP version.
- Parse error (Syntax Error) happens when the code you've written doesn't conform to the syntax or language rules for the language in which you're working. In cases like these check the file in the given location to see if there are easy syntax errors that you can fix. Usually, it’s something simple like missing “;” at the end of the line.
- Warning error means that there’s a missing file or the code is using incorrect parameters in a function. If you see Access denied for a user after Warning - check your configuration file if it uses correct database credentials.
- Fatal error - this error usually occurs when code uses a require() function and it’s not able to find the required file. Check the file in question and upload it (or restore it from the backup).
- A Depreciated error means that your website needs a lower PHP version than is currently set. Changing the PHP version to a lower one will solve the issue.
- Stackoverflow is a popular forum/community website where developers all around the world share their issues and solutions.
- Search by using your website builder/plugin forum, it’s more likely to find a solution there.