PHP 5.4 development server does not recognize mysql_connect ()

I am trying to use a new development server in PHP 5.4. It works phpinfo() perfectly, but on my site code, as well as phpMyAdmin.php they cause the following error:

Call undefined function mysql_connect ()

They work through localhost: 8000

php -m indicates that mysqlnd is loaded, but this may not be enough.

OS - Windows 7

Any thoughts?

+6
source share
2 answers

mysqlnd is a library that can be used with PHP 5.3 instead of libmysql , through three PHP extensions:

  • mysql , which provides mysql_* functions,
  • mysqli , which provides mysqli_* functions,
  • and pdo_mysql , which allows you to use PDO with a MySQL database.

mysqlnd itself does not export any function that you can use from your PHP scripts: it only provides MySQL connectivity to these 3 extensions - these are those that export functions that 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 should look like this in one of the .ini files processed by PHP

 extension=mysql.dll 


As a side element: mysql_* functions mysql_* no longer be used, especially for new projects: the mysql extension is old and does not allow you to use the latest (well, not the last, actually) MySQL functions.

Instead, you should use mysqli or PDO.

+12
source

This is because register_globals is no longer included with PHP5.4, in earlier versions it is deprecated, and you can force it on. The reason is that he would leave huge security holes for use by hackers.

+2
source

Source: https://habr.com/ru/post/908232/


All Articles