Ubuntu12.04 install Apache2 + PHP5 + MySQL

Source: Internet
Author: User
LAMP is the abbreviation of Linuxweb server combination set, which is ApacheMySQLPHP. This tutorial teaches you how to install the Apache2 server on Ubuntu12.04LTSserver, including PHP5 (mod_php) MySQL. In this tutorial, you must modify the related IP addresses in your environment. 1. We use the root account for installation. First, switch to r.

LAMP is the abbreviation of a Linux web Server combination set, which is ApacheMySQLPHP. This tutorial teaches you how to install the Apache2 server on Ubuntu12.04 LTS server, including PHP5 (mod_php) MySQL. In this tutorial, you must modify the related IP addresses in your environment. 1. We use the root account for installation. First, switch to r.

LAMP is the abbreviation of a Linux web Server combination set, namely Apache + MySQL + PHP. This tutorial teaches you how to install the Apache2 server on Ubuntu12.04 LTS server, including PHP5 (mod_php) + MySQL.

In this tutorial, you must modify the related IP addresses in your environment.

1. We use the root account for installation. First switch to the root account and enter the following command:

sudo su

2 install MySQL 5
Enter the following command:

apt-get install mysql-server mysql-client

You need to set the root account password during installation. The system will prompt you as follows:

New password for the MySQL "root" user: Repeat password for theMySQL "root" user:

3. Install Apache2
Enter the following command:

apt-get install apache2

Enter your server address in the browser and enter http: // localhost to check whether Apache2 works. If it is displayed (Itworks !), It indicates that you have already worked.

In Ubuntu, the default file root directory of Apache is/var/www, And the configuration file/etc/apache2/apache2.conf is used, additional storage subdirectories/etc/apache2 such as/etc/apache2/mod-enabled (Apache module),/etc/apache2/sites-enabled (virtual hosts ), and/etc/apache2/conf. d.

4. Install PHP5
Install the PHP5 and Apache PHP5 modules:

apt-get install php5 libapache2-mod-php5

Restart apache:

/etc/init.d/apache2 restart

5. Test PHP5/create a probe page

vi /var/www/html/info.php

Enter the following content:

Phpinfo ();
?>

Then open the browser to access (http: // localhost/info. php ):

You can see some supported modules.

6. Obtain MySQL support for PHP5
We need to install the php5-mysql, first check the php5 Module

apt-cache search php5

Then install the required module, for example, the following command:

apt-get install php5-mysql php5-curl php5-gd php5-intlphp-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-mingphp5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidyphp5-xmlrpc php5-xsl

Restart Apache2:

/etc/init.d/apache2 restart

Click http: // localhost/info. php to check whether the module support has been added.

7. phpMyAdmin
Install phpmyadmin to manage mysql:

apt-get install phpmyadmin

During the installation process, You must select Web server: apache2 or lighttpd, select apache2, press the tab key, and click OK. Then, you are required to enter the Mysql database Password of the database's administrative user.

Then, establish a connection between phpmyadmin and apache2. Take my example: the www directory is in the/var/www directory, and the phpmyadmin directory is in the/usr/share/phpmyadmin directory. Therefore, run the following command: connect sudo ln-s/usr/share/phpmyadmin/var/www.(Note: the directory structure of Apache2 has changed. There is an html directory under/var/www. This is the default root directory of the website, all above should be changed to sudo ln-s/usr/share/phpmyadmin/var/www/html)

Phpmyadmin test: Open http: // localhost/phpmyadmin in the address bar of the browser.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.