Debian lamp Environment Construction

Source: Internet
Author: User

 

DebianLowerLampEnvironment Construction

Previously, the lamp environment was installed by compiling and installing the downloaded software package. At that time, I thought that the old version of the software package was a problem when apt was used. Another major problem was that I didn't know where apt installed these software packages, so that you cannot find a configuration file to modify or start a service command. Using the manual compilation and installation method, although the installation location of the software package can be well controlled, you have to solve various dependencies on your own. For example, during PHP compilation, the correct configure process is not allowed due to various dependencies. Of course, in the Debian environment, you can use apt to install various software dependencies, but in other versions, solving such a relationship is a very laborious process.

When building lamp in the Debian environment, we only use apt to install various missing dependencies, which makes it easy to use. In fact, the use of apt to build lamp can also be installed to the latest version, and can automatically solve various dependencies, it is a very good choice. It seems that the installation of the software package on Debian should adopt apt. Next we will use apt to install our lamp environment:

1. Install MySQL

 
 
  1. # apt-get install mysql-server-5.0  
  2.  

In this way, MySQL 5.0 is installed, and various dependencies can be automatically solved, so as to install the server and client and various corresponding software packages.

2 install apache2

 
 
  1. # apt-get install apache2  
  2.  

In this way, Apache 2.x is installed.

 
 
  1. # apt-get install apache  
  2.  

The version 1.x of Apache is installed.

3 install PhP5

 
 
  1. # apt-get install php5  
  2.  

In this way, the PhP5 version is installed and various required modules are automatically installed. For example, the corresponding modules of apache2 and MySQL.

In this way, we have successfully built our lamp development environment. We can perform a simple test:

1 apt after MySQL is successfully installed, the MySQL server is started by default. We can use the following command to establish a connection with it:

 
 
  1. # mysql  
  2.  

If the MySQL prompt is displayed, the MySQL installation is successful.

2 apt after apache2 is successfully installed, The apache2 daemon is started by default. You can enter localhost in the address bar of our browser. If you can see the default homepage, the installation of apache2 is successful.

3. You can simply write a PHP script, such as PHP. php, in The apache2 directory. The default value is/var/www. The script content is as follows:

 
 
  1. phpinfo();  
  2.  
  3. ?> 
  4.  

In this way, enter

Http: // localhost/PHP. php

If correct Parsing is possible, it indicates that the installation of PHP is successful.

Here, we should note that if our PHP script is not correctly parsed, we can restart apache2 to try it, in this case, apache2 needs to be restarted to mount the corresponding PHP module:

 
 
  1. # /etc/rc2.d/S91apache2 restart  
  2.  

Of course, s91apache2 depends on the corresponding files of our system.

In addition, by default, Debian will start The apache2 and MySQL servers at startup. If you do not want to do so, refer to the related content of the Debian system startup script.

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.