Ubuntu under Lamp environment construction

Source: Internet
Author: User
Tags phpmyadmin

installation process
    • Installing Apache2
      sudo apt-get install apache2

    • Installing the PHP module
      sudo apt-get install php5

    • Install MySQL
      sudo apt-get install Mysql-server
      sudo apt-get install mysql-client

    • Other module installation
      sudo apt-get install LIBAPACHE2-MOD-PHP5
      sudo apt-get install Libapache2-mod-auth-mysql
      sudo apt-get install Php5-mysql
      sudo apt-get install PHP5-GD

    • Test if Apache is working properly
      Open the browser and enter localhost to see if there is an IT works! page display. Directory for/var/www/html, if you need to modify the directory, sudo gedit/etc/apache2/sites-available/000-default.conf,/var/www/html to replace all to become/var/www/, Then restart the Apache Server sudo service apache2 restart

    • Modify Permissions/var/www
      sudo chomod 777/var/www

    • Installing phpMyAdmin
      sudo apt-get install phpMyAdmin
      Select Apache2 during the installation process and click OK. The next option is to configure the database and enter the password.

    • Test phpMyAdmin
      sudo ln-s/usr/share/phpmyadmin/var/www
      Then run http://localhost/phpmyadmin directly to see if there is any database management software appearing.

Configuration process
  • Enable the Mod_rewrite module
    sudo a2enmod rewrite
    Restart Apache server: sudo/etc/init.d/apache2 restart or sudo service apache2 restart
  • Set Apache support. htm. html. php
    sudo gedit/etc/apache2/apache2.conf&
    Add the following sentence: AddType application/x-httpd-php. php. htm. html
  • Test the PHP page
    Edit the mysql_test.php code as follows:

    <?php   $link  = Mysql_ Connect ( "localhost" ,  "root" ,  "123" ); if  (!  $link ) die  ( Could not connect: ' . mysql_error ()); else  echo   "Mysql configuration is correct!" ; Mysql_close ( $link ); 
      ?>    
    The

    Access http://localhost/mysql_test.php display ' MySQL is configured correctly ' represents the correct configuration.

  • The third step here appeared garbled after solution
    Open config file sudo gedit/etc/apache2/apache2.conf&
    Add the following code: Adddefaultcharset UTF-8
    Restart Service (sudo service apache2 restart) takes effect.

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Ubuntu under Lamp environment construction

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.