Based on the error message, your website is showing 500 errors because of database access issues. The error message shows:
Access denied for user 'myrobot@localhost' to database 'telegram_bot_admin'
Follow these steps to fix the database access issues:
Open your config.php file and verify the database settings:
// Database configuration
define('DB_HOST', 'localhost');
define('DB_NAME', 'telegram_bot_admin');
define('DB_USER', 'myrobot');
define('DB_PASS', 'your_password');
define('DB_CHARSET', 'utf8mb4');
Make sure the database user exists and has proper permissions:
CREATE USER 'myrobot'@'localhost' IDENTIFIED BY 'your_password';
GRANT ALL PRIVILEGES ON telegram_bot_admin.* TO 'myrobot'@'localhost'; FLUSH PRIVILEGES;
Create the database if it doesn't exist:
CREATE DATABASE IF NOT EXISTS telegram_bot_admin;
Import the database schema from the schema.sql file in your database folder.
You can edit your database configuration below. Copy this updated configuration to your config.php file:
Note: If you're using XAMPP, WAMP, or similar local development environments, the default MySQL username is often 'root' with an empty password.
Make sure your logs directory exists and is writable:
// Create logs directory if it doesn't exist
$logsDir = __DIR__ . '/logs';
if (!file_exists($logsDir)) {
mkdir($logsDir, 0755, true);
}
Create a test.php file with the following code to test your database connection:
<?php
// Enable error reporting
error_reporting(E_ALL);
ini_set('display_errors', 1);
// Database configuration
$host = 'localhost';
$dbname = 'telegram_bot_admin';
$username = 'root'; // Change to your MySQL username
$password = ''; // Change to your MySQL password
try {
$db = new PDO("mysql:host=$host;dbname=$dbname", $username, $password);
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
echo "Connected successfully";
} catch(PDOException $e) {
echo "Connection failed: " . $e->getMessage();
}
?>
The 500 errors you're experiencing are caused by database access issues. Follow the steps above to fix these issues:
After making these changes, your website should work properly without 500 errors.