SitePoint Sponsor

User Tag List

Results 1 to 10 of 10
  1. #1
    SitePoint Member
    Join Date
    Nov 2009
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Localhost Does Not Respond When I Try to Create a MySQLi Connection (Win XP)

    Hi people,

    Two days before I installed MySQL Server 5.1, Apache 2.2 and PHP 5.31 in my Windows XP, following carefully the instruction given by Kevin Yank here on SitePoint at http://articles.sitepoint.com/articl...installation/2. Everything seemed ok. Every test he presented went ok. I also could see the PHP info in my browser opening 'http://localhost/phpinfo.php'. And, from the DOS MySQL Monitor, I also could open MySQL and some of its tables.

    But the things gone bad when I tried do access the mysql tables from PHP, instantiating a mysqli object. The browser quickly showed 'Connecting to localhost...' in the status bar and soon after 'Waiting answer from localhost...' but for one hole minute. Then, it showed a blank page.

    Trying to discover the problem, I simplified the php file to the following:

    <?php
    $mysqli = new mysqli("localhost" , "root" , "my_password" , "database_name");
    if ($mysqli)
    echo "OK !";
    else
    echo "Problem ! " ;
    ?>

    I saved it in the same folder of the phpinfo.php file (the Apache2.2\htdocs folder). When I called it in the browser, the same problem happened again: a hole minute wait and a hole blank page (the "Problem !" string wasn't showed).

    The php-errors.log file informs : ' PHP Fatal error: Maximum execution time of 60 seconds exceeded.' 'The connection failed because the connected host did not answer'.

    I have already configured the php.ini file with extension_dir = "C:\PHP5.31\ext" and uncommented the extension=php_mysqli.dll line.

    I have also configured the httpd.conf file of Apache, adding the line PHPIniDir "C:/PHP5.31/" at its the end.

    Can anyone help me to solve this problem ? I will be thankful.

    Marcos.
    Last edited by canbeiro; Nov 26, 2009 at 10:18. Reason: Clarify the text.

  2. #2
    SitePoint Mentor silver trophy
    Rubble's Avatar
    Join Date
    Dec 2005
    Location
    Cambridge, England
    Posts
    2,398
    Mentioned
    81 Post(s)
    Tagged
    3 Thread(s)
    The purist say that you should do as you have done but I installed XAMPP and it all worked without a hitch.

    If you do not get sorted I would uninstall what you have done and install XAMPP.

  3. #3
    From space with love silver trophy
    SpacePhoenix's Avatar
    Join Date
    May 2007
    Location
    Poole, UK
    Posts
    5,019
    Mentioned
    103 Post(s)
    Tagged
    0 Thread(s)
    A corrupt install of the mysqli extenstion is a possibility I think I remember reading a thread where someone had troubles with mysqli_ and I think they might have been using version 5.3 of php
    Community Team Advisor
    Forum Guidelines: Posting FAQ Signatures FAQ Self Promotion FAQ
    Help the Mods: What's Fluff? Report Fluff/Spam to a Moderator

  4. #4
    SitePoint Member
    Join Date
    Nov 2009
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks, SpacePhoenix, but certainly it is not a problem during the install. I tested your suggestion getting the md5 and the sha-1 hash of the instaled file and of the php_mysqli.dll file that came with the zip file and they are the same.

    Do you believe that the original php_mysqli.dll file may be corrupt ?

  5. #5
    SitePoint Member
    Join Date
    Nov 2009
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Rubble View Post
    The purist say that you should do as you have done but I installed XAMPP and it all worked without a hitch.

    If you do not get sorted I would uninstall what you have done and install XAMPP.
    Thanks, Rubble. I'm not a purist, so that I have tried Wamp before. I only want a php-mysql development behavior in my computer. But with Wamp, MySql did not recognized Innodb tables. This was the reason I abondoned it. But I also didn't liked that it changed the use of the DOS MySQL Monitor.

    Could you tell me if XAMPP also has this side-effects ?

  6. #6
    SitePoint Mentor silver trophy
    Rubble's Avatar
    Join Date
    Dec 2005
    Location
    Cambridge, England
    Posts
    2,398
    Mentioned
    81 Post(s)
    Tagged
    3 Thread(s)
    I am afraid I could not say canbeiro as I just use the standard setup.

  7. #7
    From space with love silver trophy
    SpacePhoenix's Avatar
    Join Date
    May 2007
    Location
    Poole, UK
    Posts
    5,019
    Mentioned
    103 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by canbeiro View Post
    Thanks, Rubble. I'm not a purist, so that I have tried Wamp before. I only want a php-mysql development behavior in my computer. But with Wamp, MySql did not recognized Innodb tables. This was the reason I abondoned it. But I also didn't liked that it changed the use of the DOS MySQL Monitor.

    Could you tell me if XAMPP also has this side-effects ?
    Strange that MySQL couldn't recognise Innodb tables with a WAMP setup.

    Will the mysql (not the mysqli) extension connect to MySQL ok? if it does then that would rule out a firewall problem.
    Community Team Advisor
    Forum Guidelines: Posting FAQ Signatures FAQ Self Promotion FAQ
    Help the Mods: What's Fluff? Report Fluff/Spam to a Moderator

  8. #8
    SitePoint Member
    Join Date
    Nov 2009
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by SpacePhoenix View Post
    Strange that MySQL couldn't recognise Innodb tables with a WAMP setup.

    Will the mysql (not the mysqli) extension connect to MySQL ok? if it does then that would rule out a firewall problem.
    Thanks again for your attention, SpacePhoenix. I just uncommented extension=php_mysql.dll, wrote and tried to open the following php file:

    <?php
    $mysql = mysql_connect("localhost" , "root" , "root_password");
    if ($mysql)
    echo "OK !";
    else
    echo "Problem !<br />" ;
    ?>

    The problem continues. Then I commented extension=php_mysqli.dll to prevent any conflict, without success.

    I also went to the Windows firewall, disabled it and tried to open the php files for mysql and mysqli, without success.

    Would you try other ways ?

  9. #9
    SitePoint Member
    Join Date
    Nov 2009
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Rubble View Post
    The purist say that you should do as you have done but I installed XAMPP and it all worked without a hitch.

    If you do not get sorted I would uninstall what you have done and install XAMPP.
    Hi Rubble. I want to say to you that I followed your suggestion, that it resolved my problems and that I am very happy with XAMPP. I liked very much it's easy and quick installation, it's Control Panel, it's index page and the programs that came with it and that makes possible to test it immediately. And I also liked to see that it already came with an email and a ftp servers, besides some other programs. They showed me some ways to follow ahead. So, I want to say you: thank you very much for your great suggestion !

    Have a nice weekend and till the next. Marcos.

  10. #10
    SitePoint Mentor silver trophy
    Rubble's Avatar
    Join Date
    Dec 2005
    Location
    Cambridge, England
    Posts
    2,398
    Mentioned
    81 Post(s)
    Tagged
    3 Thread(s)
    I am glad to have been of help Marcos.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •