SitePoint Sponsor

User Tag List

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

    Connecting to mysql

    Following the tutorials on this site when I try to connect to my mysql database with mysqli_connect('localhost', 'root', 'password'); I get the following error:

    Fatal error: Call to undefined function mysqli_connect()

    I am running windows Vista, PHP 5.3.3 and Apache 2.2.

    My php.ini file is allowing the "php_mysqli.dll" extension and I've uncommented the 127.0.0.1 line in my windows hosts file as some people have suggested.

    Finally I've tried swapping "localhost" with "127.0.0.1" in my PHP script and have still had no luck.

    I've searched every forum I can find and have run out of things to try.

    Any suggestions?

  2. #2
    Non-Member Kalon's Avatar
    Join Date
    Aug 2010
    Location
    At my computer
    Posts
    2,012
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    how have you installed PHP and Apache on your server?

    if you installed them separately then you probably have a configuration issue somewhere.

    another option you might want to consider is to delete your installation of PHP, Apache and MySQL (if you have it) and install a free open source local web server like XAMPP.

    XAMPP comes bundled with PHP, Apache and MySQL preconfigured to work together and ready to go - just add water

  3. #3
    Utopia, Inc. silver trophy
    ScallioXTX's Avatar
    Join Date
    Aug 2008
    Location
    The Netherlands
    Posts
    8,904
    Mentioned
    139 Post(s)
    Tagged
    2 Thread(s)
    Take a look at the section "Installation on windows machines" here: http://nl3.php.net/manual/en/mysql.installation.php

    Especially the bit about libmysql.dll
    Rémon - Hosting Advisor

    Minimal Bookmarks Tree
    My Google Chrome extension: browsing bookmarks made easy

  4. #4
    SitePoint Member
    Join Date
    Nov 2010
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hmm.. I'm still confused - I understand you have to manually enable the mysql extensions in PHP5 - I've done this with php_mysqli.dll and php_mysql.dll and am still having no luck.

  5. #5
    Utopia, Inc. silver trophy
    ScallioXTX's Avatar
    Join Date
    Aug 2008
    Location
    The Netherlands
    Posts
    8,904
    Mentioned
    139 Post(s)
    Tagged
    2 Thread(s)
    Quote Originally Posted by alkan View Post
    hmm.. I'm still confused - I understand you have to manually enable the mysql extensions in PHP5 - I've done this with php_mysqli.dll and php_mysql.dll and am still having no luck.
    How about libmysql.dll? Did you do anything to let PHP find that? Please read the link in my previous post.
    Rémon - Hosting Advisor

    Minimal Bookmarks Tree
    My Google Chrome extension: browsing bookmarks made easy

  6. #6
    SitePoint Member
    Join Date
    Nov 2010
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I've read the link, apologies I should have said in the previous post - I've added the link to libmysql.dll in the Windows PATH settings.

    Still no luck.

  7. #7
    Utopia, Inc. silver trophy
    ScallioXTX's Avatar
    Join Date
    Aug 2008
    Location
    The Netherlands
    Posts
    8,904
    Mentioned
    139 Post(s)
    Tagged
    2 Thread(s)
    You know that you should put the path to the file in the windows PATH right, not just the file?

    Also, for the PATH to take effect you need to reboot your system.
    Rémon - Hosting Advisor

    Minimal Bookmarks Tree
    My Google Chrome extension: browsing bookmarks made easy

  8. #8
    SitePoint Member
    Join Date
    Nov 2010
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I added the PHP installation path in the Environment variables yes, I have also rebooted the system - I've followed the instructions exactly how they are on the page.

  9. #9
    SitePoint Member
    Join Date
    Nov 2010
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I uninstalled everything, php, apache, mysql - restarted my PC.

    Set everything up again.

    Still having the same problem - so now I'm officially stuck at this page in the tutorial because I can't get any sort of success with mysqli_connect in php.

    http://articles.sitepoint.com/articl...mysql-data-web

  10. #10
    Non-Member Kalon's Avatar
    Join Date
    Aug 2010
    Location
    At my computer
    Posts
    2,012
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    at this stage then I think your best option, so you can at least get going again, is to install a local web server like xampp as suggested earlier.

  11. #11
    SitePoint Member
    Join Date
    Nov 2010
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Actually.. one question I wanted to ask - in the guide I'm following it states to rename a file called php.ini-dist in the PHP folder when setting up your php.ini file initially, however in my version of PHP this file didn't exist, there were 2 other files instead:

    php.ini-development
    php.ini-production

    They both look similar, I've tried modifying both with the instructions in the guide and have had no luck - this wouldn't have something to do with my problem would it?


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
  •