6

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?

2
  • Hi Bob. You need to explain your situation a bit better. What development stack are you running? For example using XAMPP or WAMP or other? "The new development server" - We need to know what that means in order to help. Commented Feb 11, 2012 at 21:47
  • 1
    @Relequestual: He means the PHP 5.4 Built-in web server: php.net/manual/en/features.commandline.webserver.php This web server is designed for developmental purposes only, and should not be used in production. Commented Mar 4, 2012 at 17:05

3 Answers 3

12

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,
  • and 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.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks, I needed to get the mysql.dll and mysqli.dll files linked in the php.ini. All is working well now.
2

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.

Comments

1

try install missing mysql module

sudo apt install php-mysqli

check if extension=mysql.so is set in php.ini after installation

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.