I am trying to use the new development server in PHP 5.4. It runs phpinfo()
just fine but on my site code and also phpMyAdmin.php
they are throwing the following error:
Call to undefined function mysql_connect()
They are running through localhost:8000
php -m
is showing that mysqlnd is loaded but that maybe not enough.
The OS is Windows 7
Any thoughts?
mysqlnd
is the library that can be used since PHP 5.3, instead of libmysql
, by 3 PHP extensions :
mysql
, which provides the mysql_*
functions, mysqli
, which provides the mysqli_*
functons, pdo_mysql
, which allows one to use PDO with a MySQL database.mysqlnd
by itself doesn't export any function you can use from your PHP scripts : it only provides MySQL connectivity to those 3 extensions -- which are the ones that export functions you can use.
If you want to use the mysql_*
functions, you have to make sure that the mysql
extension is enabled, with something that whould look like this in one of the .ini
files parsed by PHP :
extension=mysql.dll
As a sidenote : the mysql_*
functions should not be used anymore, especially for new projects : the mysql
extension is old, and doesn't allow one to use recent (well, not that recent anymore, actually) features of MySQL.
Instead, you should be using mysqli or PDO.
It's because register_globals is no longer included as of PHP5.4, in earlier versions it was deprecated and you could force it on. The reason is because it would leave huge security gaps for hackers to exploit.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With