I run phpinfo() and it loads the PHP configuration BUT "Configuration File (php.ini) Path" = no value!
It loads "mysqlnd" by default even I specified in the extension to load "mysqli" and "pdo_mysql" but it only shows PDO but it says "PDO drivers" = no value!
At the same time I run this:
phpinfo(); // it does load the configuration from the correct location BUT the script below says "not loaded"!?
$inipath = php_ini_loaded_file();
if ($inipath) {
echo 'Loaded php.ini: ' . $inipath;
} else {
echo 'A php.ini file is not loaded';
}
and I get this output:
A php.ini file is not loaded
2)
Also, the connection "$dsn = new PDO('mysql:host=localhost;dbname=mydb', $username, $password);" is not recognized, I get an error.
try{
$dsn = new PDO('mysql:host=localhost;dbname=mydb', $username, $password);
$dsn ->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}catch(PDOException $e){
print $e->getMessage();
}
Warning: Undefined variable $dsn in C:\...\index.php on line 41
Fatal error: Uncaught Error: Call to a member function prepare() on null in C:\...\index.php:41
Stack trace: #0 C:\...\index.php(18): number_of_accounts('krupta')
#1 {main}thrown in C:\...\index.php on line 41
Very likely the "Fatal error" is the result of not recognizing ("$dsn") link. This worked while runnning Php7, now I am in Php8.
Anyone would know what is going on? Thanks much.
It loads "mysqlnd" by default even I specified in the extension to load "mysqli" and "pdo_mysql" but it only shows PDO but it says "PDO drivers" = no value!
At the same time I run this:
phpinfo(); // it does load the configuration from the correct location BUT the script below says "not loaded"!?
$inipath = php_ini_loaded_file();
if ($inipath) {
echo 'Loaded php.ini: ' . $inipath;
} else {
echo 'A php.ini file is not loaded';
}
and I get this output:
A php.ini file is not loaded
2)
Also, the connection "$dsn = new PDO('mysql:host=localhost;dbname=mydb', $username, $password);" is not recognized, I get an error.
try{
$dsn = new PDO('mysql:host=localhost;dbname=mydb', $username, $password);
$dsn ->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}catch(PDOException $e){
print $e->getMessage();
}
Warning: Undefined variable $dsn in C:\...\index.php on line 41
Fatal error: Uncaught Error: Call to a member function prepare() on null in C:\...\index.php:41
Stack trace: #0 C:\...\index.php(18): number_of_accounts('krupta')
#1 {main}thrown in C:\...\index.php on line 41
Very likely the "Fatal error" is the result of not recognizing ("$dsn") link. This worked while runnning Php7, now I am in Php8.
Anyone would know what is going on? Thanks much.