Bookstore project using XAMPP 详细配置 Part 1

时间:2024-04-20 09:07:15

这是学校的一个project,记录在这里,以备复习。主要是用XAMPP通过phpMyAdmin连接MySQL数据库,实现一个简单的查询功能。

Outline

  1. Setup of XAMPP
  2. Implementation of MySQL database in “phpMyAdmin”
  3. Create PHP page
  4. User interface and test cases

1. Setup of XAMPP

1) I downloaded the XAMPP from this link (http://www.apachefriends.org/en/xampp.html).  Since I already have IIS taking port 80, I need to modify the “httpd.conf” file by clicking on “Config” on “Apache”. Then find “Listen” to change it to 85 as the port for Apache (see line 58 in Figure 1 below).

Bookstore project using XAMPP 详细配置 Part 1

Figure 1

2) Also I have installed MySQL before. So the port 3306 was taken. I need to setup another port for the MySQL in XAMPP. Edit “my.ini” by clicking “Config” on “MySQL”, then find “port” and change it from 3306 to 3307 (see line 20 and 28 in Figure 2 below).

Bookstore project using XAMPP 详细配置 Part 1

Figure 2

Here is the reference. (http://*.com/questions/18177148/xampp-mysql-does-not-start)

  

3) After these, the XAMPP is finally set up (Figure 3).

Bookstore project using XAMPP 详细配置 Part 1

Figure 3

  

4) Type in “localhost:85”, it will show correctly (Figure 4).

Bookstore project using XAMPP 详细配置 Part 1

Figure 4

  

5) When I was trying to click on “phpMyAdmin”, it gave me the error message (Figure 5)

Bookstore project using XAMPP 详细配置 Part 1

After I did some research, I found most of the suggestions were talking about password and username settings in the “config.inc.php” file under the directory of “\xamp\phpMyAdmin”. But it’s not the case for me. What I did is to change “$cfg['Servers'][$i]['host']” to “127.0.0.1:3307” instead of original “127.0.0.1” (see Figure 6 and line 22 and 27 in Figure 7).

Bookstore project using XAMPP 详细配置 Part 1

Figure 6

Bookstore project using XAMPP 详细配置 Part 1

Figure 7

Also notice that at line 22 in the file of “config.inc.php” (Figure 7), it states that the extension is “mysqli”. I was not aware of this at this stage, but it gave me a lot of trouble later in the implementation of search function of php in this assignment because “mysql” extension was used as the default method.

Also many suggest that it’s not a good practice to use “root” as the account for the database. I should avoid that in future.

Here are the references. They are not quite my case, but they helped me a lot figuring how to fix my case.

a) http://*.com/questions/7180893/mysql-said-cannot-connect-invalid-settings-xampp

b) http://*.com/questions/1276538/phpmyadmin-cant-connect-invalid-setings-ever-since-i-added-a-root-passwor).

  

6) After all of these modifications, “phpMyAdmin” finally worked (Figure 8)

Bookstore project using XAMPP 详细配置 Part 1

Figure 8