9.2 C
Munich
Thursday, March 23, 2023

[Solution] How to enable mysql_connect in PHP 5.6 and 5.5

Must read

[Solution] How to enable mysql_connect in PHP 5.6 and 5.5: Complete detail with clarification and explained in a simple way.

The main thing regarding the function named mysql_connect is totally deprecated from PHP v5.5.0 and not supported.

You can check with the official documentation for PHP mysql_connect().

Instead of this, you can use the PDO function

Best [Solution] How to enable mysql_connect in PHP 5.6 and 5.5

For Suppressing the message due to depreciation and to [be aware of other depreciation in other different codes] you can use the prefix the connect with “@”.

<?php
$connect = @mysql_connect('localhost','root','');
mysql_select_db('dbname');
?>

There are also many users who get the error: “Undefined function mysql_connect()”.

For this, you have to check first PHP MySQL extension module is being loaded.

Check first PHP info.

<?php
    phpinfo();
?>

If it’s not there then you can check the php.ini file.

;extension=php_mysql.dll 

please remove “;” before

extension=php_mysql.dll

Conclusion

Hope this article helps you in fixing How to enable mysql_connect in PHP 5.6 and 5.5.

- Advertisement -spot_img

More articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisement -spot_img

Latest article