Installation of Ubuntu--apache+php+mysql

Source: Internet
Author: User

Last night, referring to another article in the blog Park, I built a apache+php+mysql server on my Ubuntu, which I would like to keep in mind for a rainy day.

First, install Apache

sudo apt-get install apache2

After installation, restart the Apache server with the following code

sudo /ect/init.d/apache2 restart

Enter http://localhost or http://127.0.0.1 in the browser, if you see the IT works!, it means that Apache installed successfully, Apache default installation, will be in/var under a directory called WWW, This is the web directory, all the Web files that can be accessed by the browser should be placed in this directory (the actual path should be:/var/www/html).

Second, install PHP

sudo apt-get install libapache2-mod-php5 php5

Installation is complete, restart the server with the previous code, and then build a hello.php in the server directory for testing

sudo gedit/var/www/html/hello.php

then enter, save

<? PHP Echo "Hello world!" ; ? >

Then save the file, enter http://127.0.0.1/test.php in the browser, if you display the Hello world! in the Web page, it will indicate that PHP is working properly.

Third, install MySQL

sudo apt-get install mysql-server mysql-client

The Apt-get program will automatically download and install the latest MySQL version. At the end of the installation, it will ask for the password of the root of MySQL, it is best to find a Notepad to record, will be used later

Iv. installation of phpMyAdmin

sudo apt-get install phpmyadmin

phpMyAdmin settings:

During installation, you will be asked to select the Web server:apache2 or LIGHTTPD, use the SPACEBAR to choose Apache2, press the TAB key, and then OK. You will then be asked to enter the MySQL database password for the setup password password of the database ' s administrative user.

Then connect phpMyAdmin with Apache2, in my case: the WWW directory is in the/var/www/html,phpmyadmin directory in/usr/share/phpmyadmin, so just use the command:

sudo ln -s/usr/share/phpmyadmin/var/www/html

Establish a link. If the connection establishes an error, you can use the following command to remove it:

sudo rm -rf/var/www/html/phpmyadmin

phpMyAdmin test: Open Http://localhost/phpmyadmin in the browser address bar.

V. Set up read and Write permissions

sudo chmod 777 /var/www/html

Installation of Ubuntu--apache+php+mysql

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.