Ubuntu quick install lamp and MySQL management phpMyAdmin

Source: Internet
Author: User

1. Install Lamp

  1. Sudo apt-Get install apache2 mysql-server mysql-client PhP5 php5-gd
    Php5-mysql

Most lamp operations are related to the/var/WWW directory. For convenience, modify the directory permission to be accessible by common users.

  1. Sudo chmod 777/var/www/

2. phpMyAdmin Installation

  1. Sudo 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.

3. Apache configuration

(1) Enable mod_rewrite module

Terminal command: sudo a2enmod rewrite

(2) restart the Apache server: sudo/etc/init. d/apache2 restart

After Apache is restarted, you can test it and create a file test under the/var/WWW directory. PHP, write code: Save, enter http: // 127.0.0.1/test in the address bar. PHP or http: // localhost/test. PHP. If MySQL is correctly configured, both Apache and MySQL are normal. (Remember to restart the Apache server before testing ).

Test. php

  1. <? PHP
  2. $ Link = mysql_connect ("localhost", "root", "MySQL password ");
  3. If (! $ Link)
  4. {
  5. Die ('could not connect: '. mysql_error ());
  6. }
  7. Else echo "MySQL has been correctly configured ";
  8. Mysql_close ($ link );
  9. ?>

4. php Chinese garbled characters in the browser

If Chinese characters are garbled during the test. php test in the Firefox browser, the default language settings are incorrect. The solution is as follows:

Open the Apache configuration file: Udo gedit/etc/apache2/apache2.conf, add: adddefaultcharset UTF-8 at the end, if still garbled, then switch the UTF-8 to gb2312.

Restart Apache: sudo/etc/init. d/apache2 restart and refresh test. php.

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.