Why can't php connect to the database?

王林
Release: 2023-02-25 16:34:02
Original
9172 people have browsed it

Why can't php connect to the database?

Solution to the problem that PHP cannot connect to the database

Solution process:

1 , First open the browser console to see if it is a browser problem.

2. Check the apache error log

Found the problem in /var/log/apache2/error.log.1:

Uncaught Error: Class 'mysqli' not found
Copy after login

3. Locking problem

The database extension is not enabled in the php.ini file.

3.1. Open /ect/php/7.2/apache2/php.ini

3.2. Find ;extension=mysqli and remove the previous comment

4 , Restart the apache server

After restarting the server, re-run the program.

Recommended tutorial:PHP video tutorial

The above is the detailed content of Why can't php connect to the database?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!