"call to undefined function mysql_connect" Code Answer

5

After looking at your phpinfo() output, it appears the mysql extensions are not being loaded. I suspect you might be editing the wrong php.ini file (there might be multiple copies). Make sure you are editing the php file at C:phpphp.ini (also check to make sure there is no second copy in C:Windows).

Also, you should check your Apache logs for errors (should be in the logs directory in your Apache install.

If you haven't read the below, I would take a look at the comments section, because it seems like a lot of people experience quirks with setting this up. A few commenters offer solutions they used to get it working.

http://php.net/manual/en/install.windows.extensions.php

Another common solution seems to be to copy libmysql.dll and php_mysql.dll from c:PHP to C:WindowsSystem32.

By Shibon on November 28 2022
5
  1. Locate the correct php.ini file (check phpinfo() if in doubt)
  2. Locate the line saying

    extension=php_mysql_libmysql.dll
    

    and make sure it is uncommented (no ; in front)

  3. Save
  4. Restart web server
By chapinkapa on December 25 2022

Answers related to “call to undefined function mysql_connect”

Only authorized users can answer the search term. Please sign in first, or register a free account.