SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    SitePoint Member
    Join Date
    Apr 2011
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Fatal error: Call to undefined function mysqli_connect() even though i added php_mysq

    Hi guys,
    I'm trying to setup apache v2.2.17 win 32, php v5.2.17 Win32 VC6 and mysql v5.5.10 win 32 on a winxp sp3 computer.
    Up till now php is working with well with apache as I write in a .php file [code] <?php phpinfo(); ?> [\code] and this results in the beautiful php information page.
    Mysql runs well alone as I can read and write data from the mysql workbench v5.2.33b win32. I setup the odbc connector v5.1.8 win32.
    The problem is with php and mysql.
    I downloaded php_5.2.0_mysql_5.0.27-win32.zip and php_5.2.0_mysqli_5.0.27-win32.zip. I copied both php_mysql.dll and php_mysqli.dll into the php\ext directory and made sure that they are in the php.ini file "extension=php_mysql.dll extension=php_mysqli.dll".
    I also copied the libmysql.dll file from the MySQL\MySQL Server 5.5\lib directory and put it in the php\ext directory and the windows\system 32 directory.
    After doing all of that I still don't see neither the mysql nor the mysqli parts in the phpinfo and when i run any code with the [code] <?php mysql_connect(); ?> [\code] mysql_connect() function i have the error Fatal error: Call to undefined function mysqli_connect() in D:\setup\Apache Software Foundation\Apache2.2\htdocs\sls\ContentManagement\authentication.php on line 20
    can anyone help?

  2. #2
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    Can you confirm, did you restart apache between changes to the php.ini file?

  3. #3
    SitePoint Member
    Join Date
    Apr 2011
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks for the fast reply cups..i did restart the apache server...actually i restarted the whole pc to make sure after restarting the server a couple of times did no result

  4. #4
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    ... when i run any code with the
    Code:
     <?php mysql_connect(); ?>
    mysql_connect() function i have the error Fatal error: Call to undefined function mysqli_connect() in D:\setup\Apache Software Foundation\Apache2.2\htdocs\sls\ContentManagement\authentication.php on line 20
    Can you confirm, are you having problems calling:

    Code:
     <?php mysql_connect(); ?>
    OR

    Code:
     <?php mysqli_connect(); ?>
    I must admit I do not use mysqli, so apart from trying to establish you are not making a really basic error, I cannot advise you any more - apart from sending you to read the manual page again.

    It worries me a bit though that you now seem to have more than one version of PHP running on your server. Check your HDD and see how many php.ini files you have installed, if more than one then by a process of elimination (rename the php.ini files as you find them) establish which one is REALLY being picked up by PHP (or inspect the output of phpinfo() VERY closely.

    Otherwise, I'm out.

  5. #5
    SitePoint Member
    Join Date
    Apr 2011
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i tried both...and even if it was a syntax mistake in the php code that doesn't explain why mysql don't show in the phpinfo()
    i've revised everything maaany times its getting very frustrating..i think it's an error in the files..i've been at this stupid thing for the last 6 hrs
    btw..is there a website where i can get php_mysql.dll that is version 5.5 as the mysql server i have?

  6. #6
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    Mysqli_* functions are native to PHP5+ IIRC.

    mysql_* functions have had to be carefully installed since PHP5.

    So which is it that you want to use, mysqli or mysql?

    If anyone wants to chip in to this thread, please do, I don't use mysqli.

  7. #7
    SitePoint Member
    Join Date
    Apr 2011
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    although a lot of sources say that mysqli functions are more suitable for php versions 5 and more, i want to use mysql...i used it before and it worked..but now it doesn't

  8. #8
    SitePoint Member
    Join Date
    Apr 2011
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    sorry for being a nuisance
    but i wanted to know a website other than DLL Files for free download where i can redownload php_mysql.dll again.

  9. #9
    SitePoint Evangelist venkat6134's Avatar
    Join Date
    Jul 2010
    Posts
    454
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you can enable the dll extensions in the php.ini file.

    By default in php.ini file, they are like

    ;extension=php_mysql.dll
    ;extension=php_mysqli.dll



    You can enable this, by removeing this ';' as,

    extension=php_mysql.dll
    extension=php_mysqli.dll

    Then restart the server..


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
  •