• Register
0 votes
58 views

Problem :

I have set it up PHP, MySQL, and Apache. localhost() for PHP and everything is working very well. But after I downloaded the MySQL, it reports below error:

“Fatal error: Call to undefined function mysql_connect()”

How can I fix this Fatal Error?

7 5 2
3,870 points

1 Answer

0 votes

Solution :

You need to open your terminal and run the bbellow command.

sudo apt-get install mysql-server

After that if you are running the PHP then you will also need to install a php module for your mysql 5 with below command:

sudo apt-get install php5-mysql

 OR

Please use "mysqli_connect" as shown below :

$con = mysqli_connect("127.0.0.1","root","pass","your_database");

it will certainly work, I have fixed my problem with this .

OR

If you are using the Windows10, PHP 7.2 and try to connect to mysql. If above error occurred

Then please do the following steps to get it corrected.

1.    Go to your PHP installation folder,

2.    Check for your php.ini file, (Only dev, prod file is there, then one of your file as php.ini file)

3.    Look for the "extension=mysqli" and remove a ";" before it.

4.    Look for the "extension_dir" and mentioned your path of "ext" directory.

5.    Finally restart the application.

Hope this will help you in resolving your issue.

9 7 4
38,600 points

Related questions

0 votes
1 answer 8 views
8 views
What i am attempting to make a easy connection with XAMPP and MySQL server, however whenever I attempt to enter data or connect to the database, i obtain this error. Why this is happen and how to solve it?
asked Sep 14 Daniel Anderson 4k points
0 votes
1 answer 109 views
109 views
Problem : I am facing below error : Fatal error: Uncaught Error: Call to undefined function mysql_escape_string() in D:\xampp\htdocs\phoenixproject\register.php:16 Stack trace: #0 {main} thrown in D:\xampp\htdocs\phoenixproject\register.php on line 16 Well I know one thing that I am trying to mix the mysql and mysqli. Still how can I fix above issue ?
asked Dec 21, 2019 alecxe 7.5k points
0 votes
1 answer 12 views
12 views
can someone help me why i am seeing “PHP Fatal error: Uncaught Error: Call to undefined function mysql_query() in /Applications/MAMP/htdocs/lprapp/config.php:23 Stack trace:#0 {main} thrown in /Applications/MAMP/htdocs/lprapp/config.php on line 23&rdquo” this error and how to resolve it.
asked Sep 14 Daniel Anderson 4k points