Ubuntu14.04 build the LAMP environment and ubuntu14.04 build the lamp Environment

Source: Internet
Author: User

Ubuntu14.04 build the LAMP environment and ubuntu14.04 build the lamp Environment

Install Apache2

sudo apt-get install apache2

Install the PHP Module

sudo apt-get install php5

Install Mysql

sudo apt-get install mysql-serversudo apt-get install mysql-client

Install other modules

sudo apt-get install libapache2-mod-php5sudo apt-get install libapache2-mod-auth-mysqlsudo apt-get install php5-mysqlsudo apt-get install php5-gd

Test whether Apache works properly.

Open your browser and enter localhost to check whether It Works exists! Webpage display. Directory:/var/www

Modify permissions/var/www

sudo chomod 777 /var/www

Install phpmyadmin

sudo apt-get install phpmyadmin

Select apache2 during installation and click OK. The next step 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 check whether the database management software is available.

Configuration process

Step 1 enable the mod_rewrite module

sudo a2enmod rewrite

Restart the Apache server:

Sudo/etc/init. d/apache2 restart or sudo service apache2 restart

Step 2: Set apacheto support .htm. html. php

sudo gedit /etc/apache2/apache2.conf&
Add the following sentence: AddType application/x-httpd-php. php. htm. html

Step 3 test the php webpage

Edit the mysql_test.php Code as follows:
<? Php $ link = mysql_connect ("localhost", "root", "password"); if (! $ Link) die ('could not connect: '. mysql_error (); elseecho "Mysql configuration is correct! "; Mysql_close ($ link);?>
When you access http: // localhost/mysql_test.php, 'mysql configuration is correct 'indicates that the configuration is correct.

Step 4, step 3, the solution after garbled characters appear

Open the configuration file
sudo gedit /etc/apache2/apache2.conf&

Add the code below: AddDefaultCharset UTF-8

So far, the configuration is OK.

I am the dividing line of tiantiao

 

 

Reference: http://blog.csdn.net/callmeback/article/details/8130190

 


How to test whether the LAMP environment is successfully set up in the ubuntu server version?

Apache is a good test. After successful access to localhost in a browser, It works will be displayed!
Php can use phpinfo (); or php probe test, it is recommended to find a probe on the server, it will also be used in the future, no dual Castle is good
It is recommended that you use phpmyadmin for mysql and leave it on the server after it is used up. It is very convenient to manage and back up mysql.

Build the LAMP environment. Which of the following is better for Ubuntu Server and CentOS in Linux?

CentOS is obviously more stable, and there are many online tutorials.

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.