Connecting to MySql with PHP

Connecting to MySql with PHP

am 04.10.2010 23:08:24 von sueandant

------=_NextPart_000_0064_01CB6410.A9CE1220
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

I am running PHP 5.3.3, with Apache 2.0 Handler and MySql Server 5.1. =
My OS is Vista Home Premium 32 bit with SP2.

MySql works fine from the command prompt, Apache is running and PHP =
works. But I cannot access the mysqli classes. This simple program:


$mysqli =3D new mysqli("localhost", "root", "######", "testDB"); =
#I've deliberately obliterated the password

if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
} else {
printf("Host information: %s\n", mysqli_get_host_info($mysqli));
}
?>

produces this error message:

Warning: mysqli::mysqli() [mysqli.mysqli]: [2002] A connection attempt =
failed because the connected party did not (trying to connect via =
tcp://localhost:3306) in C:\Apache\htdocs\mysqlconnect.php on line 3

Warning: mysqli::mysqli() [mysqli.mysqli]: (HY000/2002): A connection =
attempt failed because the connected party did not properly respond =
after a period of time, or established connection failed because =
connected host has failed to respond. in =
C:\Apache\htdocs\mysqlconnect.php on line 3

Fatal error: Maximum execution time of 30 seconds exceeded in =
C:\Apache\htdocs\mysqlconnect.php on line 3

I guess PHP cannot find the mysqli classes. I've checked the phpinfo() =
output and discovered :

Configuration File (php.ini) Path C:\Windows =20
Loaded Configuration File C:\PHP\php.ini =20


I don't know if this ok. I've tried changing the location of the =
loaded file to C:\Windows\php.ini, but to no avail, and I don't know how =
to change the location of the config file.

I am obviously doing something wrong, but I don't know what. Can =
anyone help?

Ironically, everything worked perfectly before I upgraded to PHP 5.3.3!
------=_NextPart_000_0064_01CB6410.A9CE1220--

RES: Connecting to MySql with PHP

am 05.10.2010 14:01:07 von Alejandro Michelin Salomon

Sueandant :

Goto your my.ini file
In my case located in C:\Arquivos de programas\MySQL\MySQL Server 5.1

Search is this configuration option is enabled => skip-networking
And comment to enabled listen on a TCP/IP port. Default port 3306

Or
Put => enable-named-pipe to enable named pipes

Alejandro M.S.
-----Mensagem original-----
De: sueandant [mailto:hollandsathome@tiscali.co.uk]
Enviada em: segunda-feira, 4 de outubro de 2010 18:08
Para: php-general@lists.php.net
Assunto: [PHP] Connecting to MySql with PHP

I am running PHP 5.3.3, with Apache 2.0 Handler and MySql Server 5.1. My
OS is Vista Home Premium 32 bit with SP2.

MySql works fine from the command prompt, Apache is running and PHP works.
But I cannot access the mysqli classes. This simple program:


$mysqli = new mysqli("localhost", "root", "######", "testDB"); #I've
deliberately obliterated the password

if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
} else {
printf("Host information: %s\n", mysqli_get_host_info($mysqli));
}
?>

produces this error message:

Warning: mysqli::mysqli() [mysqli.mysqli]: [2002] A connection attempt
failed because the connected party did not (trying to connect via
tcp://localhost:3306) in C:\Apache\htdocs\mysqlconnect.php on line 3

Warning: mysqli::mysqli() [mysqli.mysqli]: (HY000/2002): A connection
attempt failed because the connected party did not properly respond after a
period of time, or established connection failed because connected host has
failed to respond. in C:\Apache\htdocs\mysqlconnect.php on line 3

Fatal error: Maximum execution time of 30 seconds exceeded in
C:\Apache\htdocs\mysqlconnect.php on line 3

I guess PHP cannot find the mysqli classes. I've checked the phpinfo()
output and discovered :

Configuration File (php.ini) Path C:\Windows
Loaded Configuration File C:\PHP\php.ini


I don't know if this ok. I've tried changing the location of the loaded
file to C:\Windows\php.ini, but to no avail, and I don't know how to change
the location of the config file.

I am obviously doing something wrong, but I don't know what. Can anyone
help?

Ironically, everything worked perfectly before I upgraded to PHP 5.3.3!


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

RES: Connecting to MySql with PHP

am 05.10.2010 14:34:30 von Alejandro Michelin Salomon

Sueandant :

Reading more carefully your email, and search for this error in the net.
Y find this page
http://coreygilmore.com/blog/2009/11/20/fix-php-5-3-hang-on- windows/

Try this

Alejandro M.S.

-----Mensagem original-----
De: Alejandro Michelin Salomon [mailto:amichelins@hotmail.com]=20
Enviada em: ter=E7a-feira, 5 de outubro de 2010 09:01
Para: 'sueandant'
Cc: php-general@lists.php.net
Assunto: RES: [PHP] Connecting to MySql with PHP

Sueandant :

Goto your my.ini file
In my case located in C:\Arquivos de programas\MySQL\MySQL Server 5.1

Search is this configuration option is enabled =3D> skip-networking
And comment to enabled listen on a TCP/IP port. Default port 3306

Or=20
Put =3D> enable-named-pipe to enable named pipes

Alejandro M.S.
-----Mensagem original-----
De: sueandant [mailto:hollandsathome@tiscali.co.uk]=20
Enviada em: segunda-feira, 4 de outubro de 2010 18:08
Para: php-general@lists.php.net
Assunto: [PHP] Connecting to MySql with PHP

I am running PHP 5.3.3, with Apache 2.0 Handler and MySql Server 5.1. =
My
OS is Vista Home Premium 32 bit with SP2.

MySql works fine from the command prompt, Apache is running and PHP =
works.
But I cannot access the mysqli classes. This simple program:


$mysqli =3D new mysqli("localhost", "root", "######", "testDB"); =
#I've
deliberately obliterated the password

if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
} else {
printf("Host information: %s\n", mysqli_get_host_info($mysqli));
}
?>

produces this error message:

Warning: mysqli::mysqli() [mysqli.mysqli]: [2002] A connection attempt
failed because the connected party did not (trying to connect via
tcp://localhost:3306) in C:\Apache\htdocs\mysqlconnect.php on line 3

Warning: mysqli::mysqli() [mysqli.mysqli]: (HY000/2002): A connection
attempt failed because the connected party did not properly respond =
after a
period of time, or established connection failed because connected host =
has
failed to respond. in C:\Apache\htdocs\mysqlconnect.php on line 3

Fatal error: Maximum execution time of 30 seconds exceeded in
C:\Apache\htdocs\mysqlconnect.php on line 3

I guess PHP cannot find the mysqli classes. I've checked the phpinfo()
output and discovered :

Configuration File (php.ini) Path C:\Windows =20
Loaded Configuration File C:\PHP\php.ini =20


I don't know if this ok. I've tried changing the location of the =
loaded
file to C:\Windows\php.ini, but to no avail, and I don't know how to =
change
the location of the config file.

I am obviously doing something wrong, but I don't know what. Can =
anyone
help?

Ironically, everything worked perfectly before I upgraded to PHP 5.3.3!


--=20
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php