# Website returns HTTP 500 when testing PDO/MySQL connection

**URL:** <https://forum.infinityfree.com/t/website-returns-http-500-when-testing-pdo-mysql-connection/121354>\
**Category:** Hosting Support\
**Created:** [October 15, 2026, 2:14pm UTC](https://forum.infinityfree.com/t/website-returns-http-500-when-testing-pdo-mysql-connection/121354 "2026-10-15T14:14:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![CJTechSupport](https://forum.infinityfree.com/letter_avatar/cjtechsupport/32/6_449c533f586939b6e5f246632a46421f.png) [@CJTechSupport](https://forum.infinityfree.com/u/CJTechSupport)\
**Post date:** [October 15, 2026, 2:14pm UTC](https://forum.infinityfree.com/t/website-returns-http-500-when-testing-pdo-mysql-connection/121354/1 "2026-10-15T14:14:32Z")

</div>

### Website URL

[https://jtncrit.freehosting.dev/login.php](https://jtncrit.freehosting.dev/login.php)

### Error Message

HTTP 500

### Other Information

The issue occurs on my InfinityFree-hosted website. A basic PHP test works, and including config/security.php also works. However, both login.php and db\_check.php return HTTP 500.

The database settings use the MySQL hostname, database name, and username provided by InfinityFree. PDO and PDO MySQL are enabled.

I have kept PHP display\_errors disabled for security.

---

<div class="post-metadata">

**Author:** ![system](https://infinityfree-forum-uploads.s3.dualstack.eu-central-1.amazonaws.com/original/3X/b/0/b024fd3fa88bae093c9576e55c2c94e33f890206.svg) [@system](https://forum.infinityfree.com/u/system)\
**Post date:** [October 15, 2026, 2:14pm UTC](https://forum.infinityfree.com/t/website-returns-http-500-when-testing-pdo-mysql-connection/121354/2 "2026-10-15T14:14:32Z")

</div>

Welcome to the InfinityFree community forum! Good to have you here.

- Most people answering here are volunteers. They’re often the fastest source of help. Admin (the only staff member) checks in about once a day for issues on our end.
- Volunteers can’t see your account or website. Share what you actually see, like error messages and what happens when you try something. That’s more useful than your theory of what’s wrong.
- AI tools often get InfinityFree wrong. If a volunteer’s advice differs from what an AI told you, please try the volunteer’s suggestion first.
- Solving an issue is a joint effort. Try the suggestions you get and report back what happened.

---

<div class="post-metadata">

**Author:** ![Lemni](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/lemni/32/68303_2.png) [@Lemni](https://forum.infinityfree.com/u/Lemni)\
**Post date:** [October 15, 2026, 2:16pm UTC](https://forum.infinityfree.com/t/website-returns-http-500-when-testing-pdo-mysql-connection/121354/3 "2026-10-15T14:16:49Z")

</div>

_Beep boop, I’m a bot! I dug through the forum to get you started. I sometimes get things wrong though, so do with this what you will until a human has a look._

The HTTP 500 means the PHP code crashed, but it doesn’t say why. To see the real error, turn on Display Errors in the control panel. The knowledge base article on this says to go to Alter PHP Config, select your domain, click Alter PHP Directives, set “Display Errors” to “On” and save. Then reload `db_check.php`.

If you still get a blank 500, your own code may be overriding that setting. Look for `ini_set('display_errors', 0);` or `error_reporting(0);` in `db_check.php`, `login.php` or any file they include. Your `config/security.php` is a good place to check, even though it loads fine on its own. Comment those lines out while you debug.

I didn’t find anything about reading server-side PHP error logs, so I can’t point you to one. Showing the errors temporarily is the method the article describes. You can turn Display Errors off again once it’s fixed.

Here is the article:

> [@Http error 500](https://forum.infinityfree.com/docs?topic=49352):
>
> When trying to access your website, you may see a page which returns the status code “500”. In Google Chrome, you’ll see a page with the error code HTTP ERROR 500. There are typically two reasons which can cause this error: The PHP code has crashed. The .htaccess file contains invalid rules. Here are some things you can try to debug and fix this. Fixing crashing PHP code A HTTP ERROR 500 simply tells you that the PHP code has crashed, but gives no information as to why it has crashed. Gett…

If the crash is in the database connection, wrap it in `try { ... } catch (PDOException $e) { echo $e->getMessage(); }`. The MySQL article says PDO throws a `PDOException` you can print. It also lists the common causes: the wrong hostname, a database name or username that’s missing its account prefix, and using the client area password instead of the hosting account password.

> [@Common MySQL Connection Errors](https://forum.infinityfree.com/docs?topic=49338):
>
> Many websites use MySQL databases to store information and settings. However, there are some reasons why the connection to the database may fail. This article describes some commonly seen error messages when connecting to a database, as well as some general tips to keep in mind when setting up a database connection. Common Error Messages Using MySQL is great, but the error message returned if there is an issue logging in to your database can be quite confusing. Here are some commonly seen error…

If that doesn’t settle it, post the exact error message you see, without the password. Also say whether `db_check.php` is the first file to touch the database, or whether `config/security.php` does too.

---

<div class="post-metadata">

**Author:** ![system](https://infinityfree-forum-uploads.s3.dualstack.eu-central-1.amazonaws.com/original/3X/b/0/b024fd3fa88bae093c9576e55c2c94e33f890206.svg) [@system](https://forum.infinityfree.com/u/system)\
**Post date:** [October 22, 2026, 2:17pm UTC](https://forum.infinityfree.com/t/website-returns-http-500-when-testing-pdo-mysql-connection/121354/4 "2026-10-22T14:17:36Z")

</div>

Closed on October 22, 2026, 2:17pm UTC

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