Apache PHP mysql installation configuration graphics Tutorial _php instance

Source: Internet
Author: User

Every technology uses a lot of people, someone will optimize it to make a simple, practical, popular tool, which is very convenient for the beginning of the and try, but for a long time to study or work this aspect of the human technical staff is not desirable, so still want to learn the basis of practical methods. As a result, I configured the Apache server to learn more deeply under Ubuntu.

This is a method of default installation, if you want to specify

Step One: install apache2

1, sudo apt-get install apache2, and then enter the administrator user's password

Enter "Y" and return to complete the installation

2, the default Web site root directory path

After the Apache installation completes the default Web site root "/var/www/html", in the site root directory has a "index.html" file, in the browser to enter localhost or 127.0.0.1, you can open the page

3, modify the site root directory

A, in the terminal window input "sudo vi/etc/apache2/apache2.conf", and then click the "Enter" button to find "<Directory/var/www/>" location--> change "/var/www/" It's OK for the new root directory.

b, in the terminal window input "sudo vi/etc/apache2/sites-available/000-default.conf"--> carriage return--> find "documentroot/var/www/html" Location--> Change "/var/www/html" to the new root directory on it, and here I will change it to "/var/www/".

c, in the browser re-enter the site root directory, see is still just the default page

D, how to see the project directory, in the terminal input "sudo mv/var/www/html/index.html/var/www/index_back.html", and then again run in the browser.

Step two, install PHP

1, sudo add-apt-repository ppa:ondrej/php can see that there are php5.5,php5.6,php7.0 three versions, you can install any one at random.

2, sudo apt-get update if you do not run this command, install PHP directly, there will be "a few packages cannot download, you can run Apt-get update------" error prompts, resulting in the inability to install.

3, sudo apt-get install php7.0 php7.0-cli php7.0-fpm php7.0-gd Php7.0-json php7.0-mysql

Step three, install MySQL

1, update the source list.

Open "Terminal Window", enter "sudo apt-get update"--> carriage return--> "Enter root password"--> carriage return is OK. If you do not run this command and install MySQL directly, you will receive a "few packages that cannot be downloaded and you can run the Apt-get update------" error message, causing the installation to fail.

2, install MySQL. Open the Terminal window, enter sudo apt-get install mysql-server mysql-client--> return--> enter "y"--> carriage return--> enter MySQL in the Package Setup dialog box " Root "user's password--> carriage return--> again the password--> carriage return, installs completes.

3, to determine whether MySQL installed successfully

Open "Terminal Window", enter "sudo service mysql restart"--> carriage return--> If MySQL starts successfully, running state indicates that the MySQL installation was successful.

step four, integrate lamp

1, the integration of PHP and Mysql:sudo apt-get install Php7.0-mysql

2, the integration of PHP and Apache:sudo apt-get install libapache2-mod-php7.03, restart Apache2:sudo service apache2 Restart Note: If the above three steps can not integrate Lam, You can try three steps. 1, open "Terminal Window", enter "sudo apt-get install libapache2-mod-auth-mysql"--> carriage return--> installation Success 2, open "terminal window", input "sudo apt-get install Php5-mysql "--> carriage return--> Installation Success Note: Be sure to remember the root password set when installing MySQL, the root user of the Ubuntu 14.04 system and the root user in MySQL are not the same user. Step five, verify the environment Apache default site root directory is located in/var/www/html/, enter this directory, and create Info.php<?phpphpinfo ();? > enter http://localhost/info.php in the browser.

attachment: wrong line

If http://localhost/info.php page is blank, try Ctrl+f5 Force refresh page.

If it's still blank, you'll need some configuration between PHP and Apache

Edit/etc/apache2/apache2.conf

<filesmatch \.php$>

SetHandler application/x-httpd-php

</FilesMatch>

Restart Apachesudo Service apache2 restart

Refresh http://localhost/info.php.

You should be able to see the contents of the phpinfo at this point.

Wonderful topic sharing: MySQL different versions of the installation Tutorials mysql5.7 version Installation Tutorials

The above is the entire content of this article, I hope to help you learn, but also hope that we support the cloud habitat community.

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.