I have installed Apache2.2 and then installed PHP5.4.8. I cannot get my new .php file to load in a browser because it keeps giving me the error Fatal error: Call to undefined function mysql_connect(). When I load the test.php file which has only this in it:
<?php phpinfo(); ?> it returns a page that shows information about PHP but where it would show the MySQL modules it only shows mysqlnd. What is that? Also, I have gone through the php.ini file and uncommented the proper lines for MySQL integration as well as having edited the Apache2.2 httpd file. Does anyone have any answers as to why MySQL isn’t working? Thanks in advance.
Also, Ive tried many of the solutions from this website as well as many google searches. I can’t seem to figure it out. 🙁
1) Have a look on choosing MySQL API. It is recommended to use
mysqliextension.2) According to Other changes to extensions, the MySQL extensions mysql, mysqli and PDO_mysql use mysqlnd as the default library now.
A quote from MySQL Native Driver – mysqlnd site:
That means, the
mysqlndextension does not export any function you can use in your scripts, but acts as a bridge between your code and one ofmysql,mysqli,pdo_mysqlextensions.You mentioned, that
phpinfo()shows only mysqlnd. The fact you don’t see section titledMySQLthere means thatmysqlextension is not enabled (commented out) inphp.ini(Windows) or your php is not compiled with mysql support (Linux). More details about installing MySQL extension are here.