Welcome to the Csdn-markdown Editor

Source: Internet
Author: User

Setting up the lamp environment on Ubuntu

The following * Refer to this article from the OSC *

There is a lamp configuration course on the website that speaks well, and also speaks about some of the extended knowledge of Ubuntu and Linux.

  • Installation

    1. sudo apt-get install apache2(A new directory will be created after installation/var/www)
    2. sudo apt-get install mysql-server mysql-client
    3. sudo apt-get install php5 libapache2-mod-php5
      sudo /etc/init.d/apache2 restartRestart Apache to load the PHP module
  • Configuration

    1. sudo vim/etc/apache2/apache2.conf
      Document last added: addtype application/ x-httpd-php. php. html. htm
      Then you need to add the default character set: adddefaultcharset UTF-8
      Add the access order of the home page file as needed:
      <ifmodule dir_module>
           directoryindex index.htm index.html index.php
      </ifmodule>
      then modify the default path for Apache: sudo vim/etc/apache2/sites-enabled/000- default.conf
      found in the document documentroot/var/www/html changed to /var/www
      Restart Apache: Service apache2 Restart
    2. sudo vim/etc/php5/apache2/php.ini
      Modify the default time zone to suit your needs, find ; Date.timezone= instead of DATE.TIMEZONE=PRC
    3. sudo vim/etc/mysql/my.cnf
      The default is to allow only local access to the database, if you want to remotely access MySQL, comment out bind-address 127.0.0.1
  • Test

    1. Enter localhost in the browser to access the index.html in the/var/www directory
    2. sudo netstat -tap | grep mysql
      If you can see tcp 0 0 localhost:mysql *.* LISTEN 1060/mysqld something like that, it means that it works, and if it doesn't work,
      mysql:sudo /etc/init.d/mysql restart
    3. sudo chmod -R 777 /var/www
      Create a new file test.php in the/var/www directory and write the following code <?php phpinfo(); ?>
      Visit localhost/test.php If you can see a page of PHP parameters that PHP is working properly.

Welcome to the Csdn-markdown Editor

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.