How to install Apache, MySQL, and PHP on Ubuntu

Source: Internet
Author: User
Tags apache php

1: first install Apache: Open the terminal (CTRL + ALT + T ),

Enter the following command:Sudo apt-Get install apache2To install,

After installation, open your browser and enter the following in the address bar:Localhost or http: // 127.0.0.1

If you see it works, the installation is successful!

Default root directory:/var/www/

2: Install MYSQL:

Sudo apt-Get install mysql-server-5.0

After installation, you will be asked to set a new MySQL Root Password, enter your own password, enter the key, and then confirm the password.

3: install PHP 5 and Apache PHP 5 module:

Sudo apt-Get install PhP5 libapache2-mod-php5

Sudo/etc/init. d/apache2 restart (restart Apache)

The attempt is successful. No:

Command: gksudo gedit/var/www/text. php [Create a text. php file under the default Apache root directory/var/www]

Enter the following in the text. php file:CodeCheck whether the installation is successful:

 
 
  1. <? PHP
  2. echo" helloworld ";
  3.   ?>

Enter http: // localhost/text. php in the address bar of the browser. If helloworld is displayed on the page, the request is successful.

Tip: if you cannot enter the command again when you return to the terminal, press Ctrl + Z.

4: make Apache and PHP support PHP:

Sudo apt-Get install libapache2-mod-auth-mysql

Sudo apt-Get install php5-mysql

Sudo/etc/init. d/apache2 restart (restart Apache)

Now the environment has been set up!

/Var/www/(put The apache2 webpage file here)

/Var/lib/MySQL (put the MySQL file here)

If you want to connect remotely, you need to install SSH with the command: sudo apt-Get Install SSH

Maybe we are still used to phpMyAdmin.

5. Install phpMyAdmin.

Sudo apt-Get install phpMyAdmin

Enter http: // localhost/phpMyAdmin in the browser to find not found.

Therefore, you must transfer the installation to the phpMyAdmin folder to/var/www /.

Sudo ln-S/usr/share/phpMyAdmin // var/www/

Run the preceding command to transfer the phpMyAdmin folder to the destination. Alternatively, you can copy phpMyAdmin directly to the/var/www/folder.

When we enter http: // localhost/phpMyAdmin in the browser again, we find that the interface we are familiar with is back.

original: http://blog.csdn.net/guaikai/article/details/6905781

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.