26

Re: Fatal error: in ***/Connect.php on line 11

opiums;
With the same server, where  scripts?

27

Re: Fatal error: in ***/Connect.php on line 11

vkle;
Yes, and the site which is in an adjacent directory and uses the same basis, but other tables, works regularly.
Besides, connection happens from the same user, only is used normal, become outdated mysql connection to a DB.

28

Re: Fatal error: in ***/Connect.php on line 11

So you consider that on the DBMS side is guaranteed there are no problems. Well, it is good. Then it is necessary only pdo_mysql to consider. Or it oddly goes not on that server, or goes where it is necessary, but manages with it not to agree at protocol level. The first is clarified above wrote as. Well and the second, probably, is described already somewhere in .

29

Re: Fatal error: in ***/Connect.php on line 11

I try to clarify what not so with PDO, found here such test:

<? php
ini_set (' error_reporting ', E_ALL);
ini_set (' display_errors', 1);
ini_set (' display_errors', 1);
ini_set (' display_startup_errors', 1);
/ *** mysql hostname ***/
$hostname = ' 192.168.1.7 ';
$database = ' craftedweb ';
/ *** mysql username ***/
$username = ' user ';
/ *** mysql password ***/
$password = ' pass';
try {
$dbh = new PDO ("mysql:host = $ hostname; dbname = $ database", $username, $password);
/ *** echo a message saying we have connected ***/
echo ' Connection was possible! ';
}
catch (PDOException $e)
{
echo $e-> getMessage ();
}
?>

As a result received: Connection was possible!

30

Re: Fatal error: in ***/Connect.php on line 11

vkle;
I in shock!
The script earned, after I took values from the test, total, we compare and we find an error.
Old script:

try {
$dbh = new PDO ("mysql:host = $ hostname; dbname = $ database", $username, $password);
/ *** echo a message saying we have connected ***/
echo ' Connection was possible! ';
}
catch (PDOException $e)
{
echo $e-> getMessage ();
}

New script:

try {
$dbh = new PDO ("mysql:host = $ hostname; dbname = $ database", $username, $password);
/ *** echo a message saying we have connected ***/
echo ' Connection was possible! ';
}
catch (PDOException $e)
{
echo $e-> getMessage ();
}

31

Re: Fatal error: in ***/Connect.php on line 11

The error there seems
The old:

try {
$db = new \PDO ("mysql: host = $ host; dbname = $ dbname", $user, $password);
}
catch (\Exception $e) {
var_dump ($e-> getMessage ());
}

The new:

try {
$db = new PDO ("mysql:host = $ host; dbname = $ dbname", $user, $password);
}
catch (PDOException $e)
{
echo $e-> getMessage ();
}

32

Re: Fatal error: in ***/Connect.php on line 11

... But it does not explain, why the old code worked from a DBMS on old server MySQL and ceased with new on MariaDB. And so... Gaps in line DSN affected?

33

Re: Fatal error: in ***/Connect.php on line 11

vkle;
Affected, still as. If to remove gaps also the old code starts to work!

34

Re: Fatal error: in ***/Connect.php on line 11

opiums;
The gap before host spoiled all

35

Re: Fatal error: in ***/Connect.php on line 11

I still wanted to write about it at once, but couples laziness was.

36

Re: Fatal error: in ***/Connect.php on line 11

opiums wrote:

new \PDO

Explain, please, a reverse slash before PDO it is normal?

37

Re: Fatal error: in ***/Connect.php on line 11

Quite, if name spaces also it is useful are used

38

Re: Fatal error: in ***/Connect.php on line 11

wrote:

For functions and constants, PHP will fall back to global functions or constants if a namespaced function or constant does not exist.

39

Re: Fatal error: in ***/Connect.php on line 11

opiums wrote:

the Gap before host spoiled all

Not without reason in a manual a line DSN without gaps. I will assume that the parameter host because of a gap has not been recognized, and PDO easy used for connection  localhost. That quite confirms your experiment with script start on local in relation to a DBMS to the machine.
And so that the morals are simple. If helps nothing, it is necessary to read the instruction attentively. smile)) smile)) smile))

40

Re: Fatal error: in ***/Connect.php on line 11

Evgenie wrote:

quite if name spaces also it is useful

are used
I would tell it "is not useful", and is mandatory". Or to import through use it is necessary, differently simply does not find a class.

41

Re: Fatal error: in ***/Connect.php on line 11

If, of course, there is no such class in leaking .