Call to undefined function mysql_connect()

Discussion in 'Site & Server Administration' started by Yoneh, May 13, 2005.

  1. #1
    I get the following error while trying to use mysql_connect():

    Fatal error: Call to undefined function mysql_connect() in C:\Apache2\htdocs\songs\checkdb.inc.php on line 3

    I use Windows, Apache, PHP, mysql:
    Windows XP Professional (and 750MHz, 512MB, 160GB)
    Apache/2.0.54 (Apr 16 2005 14:25:31)
    PHP 5.0.4 (cli) (built: Mar 31 2005 02:45:48)
    mysql Ver 14.7 Distrib 4.1.11, for Win32 (ia32)

    I have this at the end of httpd.conf:
    LoadModule php5_module "c:/php/php5apache2.dll"
    AddType application/x-httpd-php .php .wml
    PHPIniDir "C:/php"
    LoadModule php5_module "c:/php/ext/php_mysql.dll"

    The Apache server and PHP starts and works normally with that and Apache does not give any error message, but MySQL gets not loaded. When I type 'php -m' on the command line to list all modules loaded, it shows yes 'mysql' among other modules, but the mysql_connect() can't still be used.

    What's the wrong? What could I try? Is MySQL compatible with PHP5? How can I repair the problem?
     
    Yoneh, May 13, 2005 IP
  2. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,334
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #2
    You may want to use get_defined_functions() to see if any of the mysql functions are available. Maybe mysqli is installed instead or something?
     
    digitalpoint, May 13, 2005 IP
  3. kalius

    kalius Peon

    Messages:
    599
    Likes Received:
    27
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I had a similar problem this might help.

    Basically php5 don't support mysql by default you have enable it.(at least on windows + apache2 + php5 situation)

    I think this is the solution, if not try searching for php5 + mysql
    http://www.dbforums.com/t1044828.html
     
    kalius, May 13, 2005 IP
  4. Yoneh

    Yoneh Peon

    Messages:
    8
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I solved the problem!

    I had a copy of my old php.ini at the root of C:, and PHP used it instead of one in c:\windows.

    I solved the problem when I noticed that allthought I write something wrong into c:\windows\php.ini, for example 'foo foo foo', i did not get any warning from Apache. Then I remembered that I had my old php.ini at the root of C, and so removed it.

    Now it works! And thanks you very much for help!
     
    Yoneh, May 13, 2005 IP