Fw: Connecting to MySql with PHP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



----- Original Message ----- 
From: sueandant 
To: ash@xxxxxxxxxxxxxxxxxxxx 
Sent: Monday, October 04, 2010 10:29 PM
Subject: Re:  Connecting to MySql with PHP


Thanks Ash

Where do I find the PHP mysql module?   I have uncommented both the extensions php-mysql.dll and php-mysqli.dll; do I need to do more?

Thanks

Tony Holland
  ----- Original Message ----- 
  From: ash@xxxxxxxxxxxxxxxxxxxx 
  To: sueandant ; php-general@xxxxxxxxxxxxx 
  Sent: Monday, October 04, 2010 10:21 PM
  Subject: Re:  Connecting to MySql with PHP


  Have you installed the php mysql module? Basically, it tells php how to connect to mysql.

  This question has come up a few times this week, have you tried installing something like xampp or easyphp rather than the individual software components: Apache, php & mysql.

  Thanks,
  Ash
  http://www.ashleysheridan.co.uk

  ----- Reply message -----
  From: "sueandant" <hollandsathome@xxxxxxxxxxxxx>
  Date: Mon, Oct 4, 2010 22:08
  Subject:  Connecting to MySql with PHP
  To: <php-general@xxxxxxxxxxxxx>

  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:

  <?php

  $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!


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux