This question already has an answer here:
- Why shouldn't I use mysql_* functions in PHP? 15 answers
- Undefined function mysql_connect() 13 answers
I create a sample PHP file to check MYSQL database connection and save as test_db.php
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
$link = mysql_connect("localhost", "root", "1qazxsw2") or die(mysql_error());;
mysql_close($link);
?>
When I run command php test_db.php, everything is ok
But when I open it from web browser, it show 'Fatal error: Call to undefined function mysql_connect()'
How can I fix it? Now I use php-5.3.3-49.el6.x86_64
Another information: It show '--without-mysql' in php_info
</div>