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.
PHP Fatal error : Call to undefined function mysql_connect()
To correct the error, you've basically got two choices, either
1) modify the code to remove references to the mysql extension (and use mysqli or PDO instead), or
2) install an older version of PHP (before PHP7) which supports the mysql extension
FOLLOWUP:
If what you claim is true... that mysql_
functions are working under PHP7, then the most likely explanation for that is that someone installed a third party module/library that exports mysql_
functions.
I believe there was some work done to build such a library, to provide backwards compatiblity. The library would interact with the database using using the newer PHP mysqli_
functions, and provide (mostly) compatible mysql_
functions for legacy applications.
But that's not part of PHP7. That would be a third party add on.
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
XAMPP - Fatal error: Call to undefined function mysql_connect()
First, Kindly ensure the MySQL service is running.
- Open XAMPP Control Panel
- Click on Start button corresponding to MySQL module.
Then, Try checking to see if the PHP MySQL extension module is being loaded:
<?php
phpinfo();
?>
Run the above code/page and search for mysql.
If it's not there, add the following to the php.ini file:
extension=php_mysql.dll
Update: mysql_* functions have been removed in PHP 7. You probably have a php7 in XAMPP. Please use PDO or mysqli_connect("DB_HOST","DB_USER","DB_PWD")
instead of mysql_connect().
Related Topics
How to Create a Simple 'Hello World' Module in Magento
Achieve Hierarchy, Parent/Child Relationship in an Effective and Easy Way
Checking If Date Is Weekend PHP
Find a Matching or Closest Value in an Array
Curl Error 60, Ssl Certificate Issue: Self Signed Certificate in Certificate Chain
Woocommerce, Get Current Product Id
Get Name of Caller Function in PHP
Importing CSV Data Using PHP/MySQL
PHP MySQL Google Chart Json - Complete Example
"Invalid Parameter Number: Parameter Was Not Defined" Inserting Data
How to Check Whether an Array Is Empty Using PHP
Is There a PHP Function Like Python'S Zip
A Numeric String as Array Key in PHP
Pagination Using MySQL Limit, Offset
What Is the Best Method to Merge Two PHP Objects
Calling Non-Static Method With Double-Colon(::)