SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    rajug.replace('Raju Gautam'); bronze trophy Raju Gautam's Avatar
    Join Date
    Oct 2006
    Location
    Kathmandu, Nepal
    Posts
    4,013
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Call to undefined function mysql_connect()

    I have just installed PHP 5.2, Apache 2.2.3 and MySQL 5 right now. But when i run pre-built projects here it says:
    Code:
    Call to undefined function mysql_connect()
    What did i miss?

    Please help me.

  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)
    Mysql has to be specifically compiled from PHP5 onwards, its not bundled any longer.

    On Win that means uncommenting lines in your ini file and making sure some dlls are made available.

    The man page spells it out, but it frequently goes wrong if your local machine is set up differently, search this forum for many discussions on it.

    good luck!

    ps if youre new to PHP5 I thoroughly recommend Trachtenbergs "Upgrading to PHP5" - short, concise, packed with tips, and relatively cheap. At last look it was PHP5 only, not 5.2 which has more features of course.

  3. #3
    SitePoint Enthusiast
    Join Date
    Sep 2005
    Posts
    75
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    search your php.ini for extension=php_mysql.dll remove ; at the begining of the line if it has. And don't forget to restart apache

  4. #4
    rajug.replace('Raju Gautam'); bronze trophy Raju Gautam's Avatar
    Join Date
    Oct 2006
    Location
    Kathmandu, Nepal
    Posts
    4,013
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yes this i said before on first post that its PHP 5.2 and apache 2.2.3 and mysql 5.1. When i uncomment the line in my php.ini:
    Code:
    extension=php_mysql.dll
    still it says the same error.

  5. #5
    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)
    "...making sure some dlls are made available."

    Thats the tricky bit.

    PHP Manual - http://fr.php.net/mysql
    PHP 5+

    MySQL is no longer enabled by default, so the php_mysql.dll DLL must be enabled inside of php.ini. Also, PHP needs access to the MySQL client library. A file named libmysql.dll is included in the Windows PHP distribution and in order for PHP to talk to MySQL this file needs to be available to the Windows systems PATH. See the FAQ titled "How do I add my PHP directory to the PATH on Windows" for information on how to do this. Although copying libmysql.dll to the Windows system directory also works (because the system directory is by default in the system's PATH), it's not recommended.

    As with enabling any PHP extension (such as php_mysql.dll), the PHP directive extension_dir should be set to the directory where the PHP extensions are located. See also the Manual Windows Installation Instructions. An example extension_dir value for PHP 5 is c:\php\ext

    Note: If when starting the web server an error similar to the following occurs: "Unable to load dynamic library './php_mysql.dll'", this is because php_mysql.dll and/or libmysql.dll cannot be found by the system.

  6. #6
    rajug.replace('Raju Gautam'); bronze trophy Raju Gautam's Avatar
    Join Date
    Oct 2006
    Location
    Kathmandu, Nepal
    Posts
    4,013
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It worked when the libmysql.dll copied to windows system directory. Thanx all for the help.

  7. #7
    SitePoint Wizard cranial-bore's Avatar
    Join Date
    Jan 2002
    Location
    Australia
    Posts
    2,634
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    For future reference, to whom it may concern, a similar thing may be necessary to get cURL working.

    In this case it is libeay32.dll and ssleay32.dll that need to be "findable" to enable the extension.
    Ideally if you've added you're PHP directory to the system path no file moving will be necessary, otherwise, try copying them to the Windows folder.


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
  •