loading but not showing

prescot

New member
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.
 
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.
 
Is there anyway to alter the Php path on windows?
Right now by default it is set "c:\php\.." BUT if I want to be in "c:\mydir\php\..", can I set the path or do I have to have my own script and call the script that would call the php directory then? Is that something I can set in ".conf" file? Thanks
 
Back
Top