Php/Apache: PHP Fatal Error: Call to Undefined Function MySQL_Connect()

Fatal error: Uncaught Error: Call to undefined function mysql_connect()

mysql_* functions have been removed in PHP 7.

You probably have PHP 7 in XAMPP. You now have two alternatives: MySQLi and PDO.

Undefined function mysql_connect()

Well, this is your chance! It looks like PDO is ready; use that instead.

Try checking to see if the PHP MySQL extension module is being loaded:

<?php
phpinfo();
?>

If it's not there, add the following to the php.ini file:

extension=php_mysql.dll

Fatal error: Call to undefined function mysql_connect() in C:\Apache\htdocs\test.php on line 2

Uncomment the line extension=php_mysql.dll in your "php.ini" file and restart Apache.

Additionally, "libmysql.dll" file must be available to Apache, i.e., it must be either in available in Windows systems PATH or in Apache working directory.

See more about installing MySQL extension in manual.

P.S. I would advise to consider MySQL extension as deprecated and to use MySQLi or even PDO for working with databases (I prefer PDO).

Uncaught Error: Call to undefined function mysql_connect() - WordPress Setup

I found the solution, All you have to do is uncomment these lines in php.ini

extension=mysqli
extension=pdo_mysql

php+mysql Fatal error: Call to undefined function mysql_connect() in

As it was already said use phpinfo() for determining if mysql is running correctly.
In general you should not use mysql anymore more but rather the new improved version of mysql, called mysqli http://php.net/manual/de/book.mysqli.php

You can in addition programmatically check if a function exists with method_exists method



Related Topics



Leave a reply



Submit