Use apt to install and configure lamp in ubuntu9.04

Source: Internet
Author: User
Tags mysql in fully qualified domain name

Install lamp in Ubuntu by using the new version. For more information, see the previous article. According to the article, there is generally no problem.
However, sometimes the installation of lamp may not be smooth, and some may want to install it through apt. This article introduces these contents.

I. Preparations

If lamp is not installed in the system, run the following code:
Sudo apt-Get update

If lamp has been installed in the system before, ensure that apache2, PhP5, and MySQL in the system are completely deleted. Search PhP5, apache2, respectively in the new software package manager, mySQL deletes the installed software package and dependency package. You can also run the code in the terminal:
Sudo apt-Get remove-Purge apache2 apache2-mpm-prefork apache2-utils
Apache2.2-common libapache2-mod-php5 libapr1 libaprutil1
Libdbd-mysql-perl libdbi-perl libmysqlclient15off Libnet-Daemon-perl
Libplrpc-perl libpq5 mysql-client-5.0 for MySQL-common mysql-Server
Mysql-server-5.0 php5-common php5-mysql
Sudo Rm-r/etc/PhP5

Execute the following code for cleanup:
Sudo apt-Get autoremove
Sudo apt-Get autoclean

Ii. Install Lamp

The code to be executed is as follows:
1. install Apache
Sudo apt-Get install apache2
2. install PHP
Sudo apt-Get install PhP5
3. Install MySQL
Sudo apt-Get install mysql-server libapache2-mod-auth-mysql php5-mysql

Iii. Solutions to two Common Problems

1. apache2: cocould not determine the server's fully qualified domain name, using 127.0.0.1 for servername
Modify the configuration file of apahce:
Sudo gedit/etc/apache2/CONF. d/FQDN
If you cannot use gedit, you can use vim.
Add:
Servername localhost

Save and exit. Run the following command:
Echo "servername localhost" | sudo tee/etc/apache2/CONF. d/FQDN
If the terminal displays:
Servername localhost
Indicates that the setting is successful.

2. The php file cannot be parsed. the browser prompts you to download the PHP file to be opened.
First, check whether the software is correctly installed.
Sudo apt-Get install libapache2-mod-php5
Sudo a2enmod PhP5
If the result is:
This module does not exist!
Then you need to thoroughly Delete the libapache2-mod-php5 and then reinstall it.
The installation is to execute the following code:
Sudo apt-Get remove-Purge libapache2-mod-php5
Sudo apt-Get install libapache2-mod-php5

After the installation is complete, restart apache2.
Sudo/etc/init. d/apache2 restart

Clear the browser cache and enter http: localhost. (For Firefox, this step is critical .)

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.