• Debian 11 is approaching its end-of-life (vendor EOL date - August 31, 2026). Plesk Obsidian 18.0.80 will be the last release to support it.
    If you are running Plesk Obsidian on Debian 11, we recommend you upgrade those servers to Debian 12 using our dist-upgrade tool.
  • We plan to deprecate and remove the support for XML RPC protocol versions earlier than 1.6.9.1 in Plesk Obsidian 18.0.82. We strongly recommend that you update all existing integrations using earlier versions of the XML RPC protocol to comply with the version 1.6.9.1 specification.

Issue PHP Fatal error: Uncaught Error:

protonplsk

New Pleskian
Hi,

I have an error on my site in php, the mariadb database does not load the elements. The following error appears in the logs:

[AH01071: Got error 'PHP message: PHP Fatal error: Uncaught Error: Call to undefined method PDOStatement::prepare() in /var/www/vhosts/pmfermetures.com/vibrant-payne.185-63-174-144.plesk.page/DB/requests_bdd.php:8\nStack trace:\n#0 /var/www/vhosts/pmfermetures.com/vibrant-payne.xxx-xx-xxx-xxx.plesk.page/index.php(4): include_once()\n#1 {main}\n thrown in /var/www/vhosts/pmfermetures.com/vibrant-payne.xxx-xx-xxx-xxx.plesk.page/DB/requests_bdd.php on line 8']

However pdo is activated and the php is at the correct version.

This code works on another server under Ubuntu with Apache

<?php
class DbConnexion
{
private $host = "localhost";
private $dbName = "";
private $user = "";
private $password = "";
protected $bdd;
public function __construct()
{
$this->connexion();
}
protected function connexion()
{
try {
$this->bdd = new PDO('mysql:host=' . $this->host . ';dbname=' . $this->dbName, $this->user, $this->password);
$this->bdd->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
$this->bdd->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_OBJ);
} catch (Exception $e) {
die('Erreur : ' . $e->getMessage());
}
}
protected function getmyDb()
{
if ($this->bdd instanceof PDO)
{
return $this->bdd;
}
}
}

And for requests_bdd.php :

/*Request Data*/
$req_data = $dbh->prepare('SELECT * FROM data WHERE id = 1');
$req_data->execute();
$result_data = $req_data->fetch(PDO::FETCH_ASSOC);

Thanks for any help.
 
Hi,

I have an error on my site in php, the mariadb database does not load the elements. The following error appears in the logs:

[AH01071: Got error 'PHP message: PHP Fatal error: Uncaught Error: Call to undefined method PDOStatement::prepare() in /var/www/vhosts/pmfermetures.com/vibrant-payne.185-63-174-144.plesk.page/DB/requests_bdd.php:8\nStack trace:\n#0 /var/www/vhosts/pmfermetures.com/vibrant-payne.xxx-xx-xxx-xxx.plesk.page/index.php(4): include_once()\n#1 {main}\n thrown in /var/www/vhosts/pmfermetures.com/vibrant-payne.xxx-xx-xxx-xxx.plesk.page/DB/requests_bdd.php on line 8']

However pdo is activated and the php is at the correct version.

This code works on another server under Ubuntu with Apache

<?php
class DbConnexion
{
private $host = "localhost";
private $dbName = "";
private $user = "";
private $password = "";
protected $bdd;
public function __construct()
{
$this->connexion();
}
protected function connexion()
{
try {
$this->bdd = new PDO('mysql:host=' . $this->host . ';dbname=' . $this->dbName, $this->user, $this->password);
$this->bdd->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
$this->bdd->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_OBJ);
} catch (Exception $e) {
die('Erreur : ' . $e->getMessage());
}
}
protected function getmyDb()
{
if ($this->bdd instanceof PDO)
{
return $this->bdd;
}
}
}

And for requests_bdd.php :

/*Request Data*/
$req_data = $dbh->prepare('SELECT * FROM data WHERE id = 1');
$req_data->execute();
$result_data = $req_data->fetch(PDO::FETCH_ASSOC);

Thanks for any help.
Your request have not any relation with plesk panel....suggere you that search solution in programming forums : Call to undefined method PDOStatement::Prepare() - Google Suche
 
Back
Top