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
Tcpdf and Insert an Image Base64 Encoded
Access MySQL Field's Comments with PHP
Working with Japanese Filenames in PHP 5.3 and Windows Vista
Model->Save() Not Working in Yii2
Using PHP, How to Insert Text Without Overwriting to the Beginning of a Text File
Unix Permissions, Read VS. Execute (PHP Context)
Is It Acceptable to Use a Mix of Object Oriented Style with Procedural Style in Coding PHP
How to Curry Method Calls in PHP
Patterns for PHP Multi Processes
Issues Porting PHP/Gd Wrapper to Imagick
PHP Xpath - Find Element with a Value and Also Get Elements Before and After Element
Php:Difference Between '&&' and 'And'
How to Allow a User to Download a File Which Is Stored Outside of the Webroot
Simplexmlelement and Xpath, Getting Empty Array()
PHP JSON_Decode Fails Without Quotes on Key
What Is Laravel Render() Method For