mysql_connect() error message
apache, mysql, php
Solution
1) Have a look on choosing MySQL API. It is recommended to use `mysqli` extension.
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:
Although MySQL Native Driver is written as a PHP extension, it is important to note that it does not provide a new API to the PHP programmer. The programmer APIs for MySQL database connectivity are provided by the MySQL extension, mysqli and PDO MYSQL. These extensions can now use the services of MySQL Native Driver to communicate with the MySQL Server. Therefore, you should not think of MySQL Native Driver as an API.
That means, the `mysqlnd` extension does not export any function you can use in your scripts, but acts as a bridge between your code and one of `mysql`, `mysqli`, `pdo_mysql` extensions.
You mentioned, that `phpinfo()` shows only mysqlnd. The fact you don't see section titled `MySQL` there means that `mysql` extension is not enabled (commented out) in `php.ini` (Windows) or your php is not compiled with mysql support (Linux). More details about installing MySQL extension are here.
Problem
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. :-(