Ubuntu12.04 install Apache2 + PHP5 + MySQL_MySQL

Source: Internet
Author: User
Ubuntu12.04 install Apache2 + PHP5 + MySQL UbuntuApache

Original article: http://blog.csdn.net/gaokao2011/article/details/24725537

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: // 192.168.0.100 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/info. php


Enter the following content:


Phpinfo ();
?>


Then open the browser to access (http: // 192.168.0.100/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


Restart Apache2:


/Etc/init. d/apache2 restart


Click http: // 192.168.0.100/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.
Phpmyadmin test: open http: // localhost/phpmyadmin in the address bar of the browser.

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.