Build and configure LAMP (Linux + Apache + MySQL + PHP) in Ubuntu

Source: Internet
Author: User
Build and configure LAMP (Linux + Apache + MySQL + PHP) In Ubuntu. 1. Install SSH: sudoapt-getinstallssh2. install Apache: sudoapt-getinstallapache2 and then run the setup and configuration process of LAMP (Linux + Apache + MySQL + PHP) in Apache: Ubuntu.

1. Install SSH:

  1. Sudo apt-get install ssh

2. install Apache:

  1. Sudo apt-get install apache2
Then run Apache:
  1. Sudo/etc/init. d/apache2 restart
Apache creates a directory/var/www, which is the root directory for storing documents and can be accessed using http: // localhost.

3. Install MySQL:

  1. Sudo apt-get install mysql-server-5.1 mysql-client-5.1
During installation, you will be prompted to set the root password.

4. install PHP:

  1. Sudo apt-get install php5 libapache2-mod-php5

5. Install phpMyAdmin

  1. Sudo apt-get install phpmyadmin

Configuration:

1. Path of the configuration file:

Apache:/etc/apache2/apache2.conf

PHP:/etc/php5/apache2/php5.ini

MySQL:/etc/mysql/my. cnf

PhpMyAdmin:/etc/phpmuadmin/apache. conf

Website root directory:/var/www

2. Configure Apache:

Sudo gedit/etc/apache2/apache2.conf

Supported file types are added:

AddType application/x-httpd-php. php. html. htm

Default character set:

Adddefacharcharset UTF-8

3. Configure PHP:

Sudo gedit/etc/php5/apache2/php. ini

Change the local time zone as needed:

Date. timezone = PRC

4. Configure MySQL:

Sudo gedit/etc/mysql/my. cnf

5. Configure phpMyAdmin:

Transfer the default directory to/var/www:

Cd/var/www

Sudo ln-s/usr/share/phpmyadmin

Then:

Sudo gedit/etc/phpmyadmin/apache. conf

Change/usr/share/phpmyadmin to/var/www/phpmyadmin.


6. sudo chmod-R 777/var/www


Test:

1. http: // localhost has It works! Words

2. sudo netstat-tap | grep mysql

If it cannot be started properly, it runs:

Sudo/etc/init. d/mysql restart

3. sudo vi/var/www/test. php

Input content:

  1. Phpinfo ();
  2. ?>
Http: // localhost/test. php outputs the PHP parameter.

4. http: // localhost/phpmyadmin. the root user name and password are set just now.

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.