currently unable to handle this request.HTTP ERROR 500

Loops

New member
Joined
Dec 7, 2023
Messages
6
My website is PHP. I get this error when I try to access it.
I added this in my PHP code.

error_reporting(E_ALL);
ini_set('display_errors', 1);

it gives tis error in the browser

Fatal error: Uncaught Error: Class 'mysqli' not found in /home/xxxxxxxxx/domains/charityfoundation.org/public_html/config/database.php:5 Stack trace: #0 /home/xxxxxxxxx/domains/charityfoundation.org/public_html/partials/header.php(2): require() #1 /home/xxxxxxxxx/domains/charityfoundation.org/public_html/index.php(4): include('/home/xxxxxxxxx/...') #2 {main} thrown in /home/xxxxxxxxx/domains/charityfoundation.org/public_html/config/database.php on line 5
 
what is the php code of line 5 in database.php in folder config on charityfoundation.org ?
 
what is the php code of line 5 in database.php in folder config on charityfoundation.org ?
This is my database.php

<?php
require 'constants.php';

//connect to the database
$connection = new mysqli(DB_HOST, DB_USER, DB_PASS, DB_NAME);

if(mysqli_errno($connection)){
die(mysqli_error($connection));
}

and this i the constants.php

<?php
session_start();
define('ROOT_URL', 'https://charityfoundation.org/');
define('DB_HOST','localhost');
define('DB_USER','xxxxxxx_x');
define('DB_PASS','xxxxxxx');
define('DB_NAME','xxxx_database');
 
The command:

Bash:
# /usr/local/php74/bin/php -i | grep -i ^mysqli

should print the following output:

Bash:
mysqli
mysqli.allow_local_infile => Off => Off
mysqli.allow_persistent => On => On
mysqli.default_host => no value => no value
mysqli.default_port => 3306 => 3306
mysqli.default_pw => no value => no value
mysqli.default_socket => /var/lib/mysql/mysql.sock => /var/lib/mysql/mysql.sock
mysqli.default_user => no value => no value
mysqli.max_links => Unlimited => Unlimited
mysqli.max_persistent => Unlimited => Unlimited
mysqli.reconnect => Off => Off
mysqli.rollback_on_cached_plink => Off => Off
API Extensions => pdo_mysql,mysqli

if it differs much in your case, then you need to recompile PHP with MySQLi support:

Bash:
# grep mysqli /usr/local/directadmin/custombuild/*/*php*/configure.php74
/usr/local/directadmin/custombuild/configure/php/configure.php74:       --with-mysqli=mysqlnd \
/usr/local/directadmin/custombuild/custom/php/configure.php74:        --with-mysqli=mysqlnd \
 
The command:

Bash:
# /usr/local/php74/bin/php -i | grep -i ^mysqli

should print the following output:

Bash:
mysqli
mysqli.allow_local_infile => Off => Off
mysqli.allow_persistent => On => On
mysqli.default_host => no value => no value
mysqli.default_port => 3306 => 3306
mysqli.default_pw => no value => no value
mysqli.default_socket => /var/lib/mysql/mysql.sock => /var/lib/mysql/mysql.sock
mysqli.default_user => no value => no value
mysqli.max_links => Unlimited => Unlimited
mysqli.max_persistent => Unlimited => Unlimited
mysqli.reconnect => Off => Off
mysqli.rollback_on_cached_plink => Off => Off
API Extensions => pdo_mysql,mysqli

if it differs much in your case, then you need to recompile PHP with MySQLi support:

Bash:
# grep mysqli /usr/local/directadmin/custombuild/*/*php*/configure.php74
/usr/local/directadmin/custombuild/configure/php/configure.php74:       --with-mysqli=mysqlnd \
/usr/local/directadmin/custombuild/custom/php/configure.php74:        --with-mysqli=mysqlnd \
So where im i supposed ti input that command
 
For the further actions you need to use bash as root (usually over SSH). If you are not familiar with it, you'd better contact your hosting company, server provider or DirectAdmin support if you have their support.

If you don't have a free support from either of them, then you'd better hire somebody for this. Working in bash as root without an experience you might bring your server down. Even if I can print commands here correct I don't warranty that you type them correct in CLI and get a desired result. I can give warranties only for work I do myself.
 
Back
Top