Home  >  Article  >  Backend Development  >  Tutorial steps for connecting MySQL and PHP (pictures and texts)

Tutorial steps for connecting MySQL and PHP (pictures and texts)

PHP中文网
PHP中文网Original
2017-06-17 15:55:291551browse

In this article, we introduce the integration of PHP and MySQL. Since it is integrated with MySQL, we must first install MySQL. Below we will introduce the installation method of MySQL.

The first step is to download MySQL. To download PHP, you can go to the PHP Chinese website download site to download the latest version.

Tutorial steps for connecting MySQL and PHP (pictures and texts)

The second step is to install the MySQL database

Tutorial steps for connecting MySQL and PHP (pictures and texts)

Tutorial steps for connecting MySQL and PHP (pictures and texts)

The third step is the same as installing Apache. Create a MySQL folder under the PHPedu folder and install it in the folder. Change the installation directory and click Next

The fourth step is to start the installation

Tutorial steps for connecting MySQL and PHP (pictures and texts)

Tutorial steps for connecting MySQL and PHP (pictures and texts)

1Tutorial steps for connecting MySQL and PHP (pictures and texts)

Just click Next from this step,

1Tutorial steps for connecting MySQL and PHP (pictures and texts)

Until this step, we set up an administrator, set the password here, and click Next

1Tutorial steps for connecting MySQL and PHP (pictures and texts)

Click the arrow to continue the installation

Tutorial steps for connecting MySQL and PHP (pictures and texts)

Even if the installation is complete

Tutorial steps for connecting MySQL and PHP (pictures and texts)

Next we will integrate PHP and MySQL. First open the php.ini configuration file under the PHP folder in the editor, and then locate extension_dir in the editor, around line 720, as shown below:

Tutorial steps for connecting MySQL and PHP (pictures and texts)

Next, uncomment the corresponding line of code, as shown below:

Tutorial steps for connecting MySQL and PHP (pictures and texts)

At this point, the MySQL configuration we need to modify has been modified. The next step is to restart our Apache server. After the database is opened, it needs to be connected. How to connect to php mysql? We need to write a piece of code to connect to the database, as shown below:

Tutorial steps for connecting MySQL and PHP (pictures and texts)

Run it on the browser and you will see that the connection is successful

1Tutorial steps for connecting MySQL and PHP (pictures and texts)1Tutorial steps for connecting MySQL and PHP (pictures and texts)

Okay, now the integration of our database and our PHP is complete.

The above is the detailed content of Tutorial steps for connecting MySQL and PHP (pictures and texts). For more information, please follow other related articles on the PHP Chinese website!

Statement:
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