Hướng dẫn Cài đặt apache cùng với mysql và php trên ubuntu 12.04 LTS

songlamjermaine

New member
** Cách cài đặt Apache với MySQL và PHP trên Ubuntu 12.04 LTS **

** Bước 1: Cài đặt Apache **

`` `
sudo apt-get install apache2
`` `

** Bước 2: Cài đặt MySQL **

`` `
sudo appt-get cài đặt mysql-server mysql-client
`` `

** Bước 3: Cài đặt PHP **

`` `
sudo apt-get cài đặt php5 libapache2-mod-php5 php5-mysql
`` `

** Bước 4: Định cấu hình Apache **

Chỉnh sửa tệp sau:

`` `
/etc/apache2/apache2.conf
`` `

Thêm các dòng sau vào cuối tệp:

`` `
<Thư mục/var/www/html>
Cho phép tất cả
</Thư mục>
`` `

** Bước 5: Khởi động lại Apache **

`` `
SUDO Service Apache2 Khởi động lại
`` `

** Bước 6: Tạo tệp PHP **

Tạo một tệp mới có tên `index.php` trong thư mục`/var/www/html`.

`` `
<Html>
<Body>
<H1> Xin chào Thế giới! </H1>
</Body>
</html>
`` `

** Bước 7: Truy cập tệp PHP trong trình duyệt của bạn **

Mở trình duyệt của bạn và điều hướng đến URL sau:

`` `
http: //localhost/index.php
`` `

Bạn sẽ thấy đầu ra sau:

`` `
<Html>
<Body>
<H1> Xin chào Thế giới! </H1>
</Body>
</html>
`` `

**Chúc mừng!Bạn đã cài đặt thành công Apache với MySQL và PHP trên Ubuntu 12.04 LTS. **
=======================================
**How to install Apache with MySQL and PHP on Ubuntu 12.04 LTS**

**Step 1: Install Apache**

```
sudo apt-get install apache2
```

**Step 2: Install MySQL**

```
sudo apt-get install mysql-server mysql-client
```

**Step 3: Install PHP**

```
sudo apt-get install php5 libapache2-mod-php5 php5-mysql
```

**Step 4: Configure Apache**

Edit the following file:

```
/etc/apache2/apache2.conf
```

Add the following lines to the end of the file:

```
<Directory /var/www/html>
AllowOverride All
</Directory>
```

**Step 5: Restart Apache**

```
sudo service apache2 restart
```

**Step 6: Create a PHP file**

Create a new file called `index.php` in the `/var/www/html` directory.

```
<html>
<body>
<h1>Hello World!</h1>
</body>
</html>
```

**Step 7: Access the PHP file in your browser**

Open your browser and navigate to the following URL:

```
http://localhost/index.php```

You should see the following output:

```
<html>
<body>
<h1>Hello World!</h1>
</body>
</html>
```

**Congratulations! You have successfully installed Apache with MySQL and PHP on Ubuntu 12.04 LTS.**
 
Join Telegram ToolsKiemTrieuDoGroup
Back
Top