The easiest way to install the LAMP environment in Ubuntu

Source: Internet
Author: User
Tags php3 file
Many companies may be familiar with the LAMP environment in recruitment. but how can we build the LAMP environment? When you search for this question in a search engine, the answer may make it difficult for someone who is not familiar with Linux commands, A large number of complex commands (you may not know what this means) are complicated. you may find that many companies require familiarity with the LAMP environment during recruitment. but how can we build the LAMP environment? When you search for this question in a search engine, the answer may make it difficult for someone who is not familiar with Linux commands, A large number of complex commands (you may not know what this means), tedious steps, may fail to be configured due to version problems, you do not know what the system is in or how to redo it at this time. This problem may lead you back to the wamp environment in Windows, so that you never know what the LAMP environment is in Linux, so the purpose of my article is to make more people accept the LAMP environment.



First, I would like to briefly introduce what Ubuntu is. First, it is a Linux, and then it is a very useful Linux. you don't have to go online to find and download the software you need, because all of his software is in the central database, if you want to know about Ubuntu, you can read other information and will not go into details.

After installing Ubuntu, upgrade your system. you only need to restart the machine once and remember to restart it. Otherwise, you will not be able to see anything, because the integrated environment package for the LAMP environment is available only in version 6 or later, you must upgrade your system after installation. Restart the machine.


Next, if you are in an English environment, follow these steps:

System --> Administration --> Synaptic Package Manager --> Edit --> Mark packages by Task --> LAMP Server --> OK

System -- System Management -- new software package manager-edit -- use task tag Group software package --

LAMP Server (check) -- Return to the previous window and click Application. at this time, the system will automatically download and install the LAMP environment package, which will soon be completed, in addition, every time the system is upgraded, the LAMP environment will be upgraded to the latest version. click it. enter 127.0.0.1 in your browser and you will see it works! It indicates that apach has started to work. at this time, you can look at some php programs under the var/www directory in the system file directory. as for php editing under Ubuntu, in fact, the editor is very easy to use with notepad. after all, they are all open-source and support better.

This is simple. your LAMP environment has been installed in this way. it is as simple as wamp, but this is LAMP. This may be the simplest installation method! Of course, there are also a few issues. you need to know how to set the permissions for the www Directory. Otherwise, you cannot copy files to the www Directory. who makes Linux very secure! Well, you only need to use commands like chgrp chmod with the root permission to change it, but this frees you from the complicated installation process in the LAMP environment. do you think it is good? The following is the basic installation procedure (php3). The running environment is a UNIX system platform. Before installation, download the apache_1.3.x.tar.gz and php-3.0.x.tar.gz files. You can put the two files in/usr/src and then start to perform the following steps. Next, each row number is followed by a step. all options in the step are connected. do not execute them separately.

Gzip-d-c apache_1.3.x.tar.gz | tar xvf-


Gzip-d-c php-3.0.x.tar.gz | tar xvf-
Cd apache_1.3.x
./Configure -- prefix =/www
Cd./php-3.0.x
./Configure -- with-mysql -- with-apache = ../apache_1.3.x -- enable-track-vars
Make
Make install
Cd ../apache_1.3.x
./Configure -- prefix =/www -- activate-module = src/modules/php3/libphp3.a
Make
Make install
The first and second lines use gzip and tar plus the MPs queue function to decompress and restore the compressed file. Then, execute the environment configuration in the original Apache file directory. the -- prefix option indicates the path of the Apache installation directory. Then go to the original PHP3 file directory. if there is no MySQL database, you can omit the -- with-mysql option. it is important to add the -- with-apache option, the path of the original Apache file must be correct. After PHP3 is configured, it is compiled and installed in the original Apache file directory. Then add the PHP module file to the original Apache file directory. After compiling and installing Apache, it is initially completed. Then we need to configure Apache to make the Web Server operate smoothly.


Note that to connect PHP to any database, you must set up the database before performing these steps and ensure that the database system can be smoothly accessed on the Web Server. If you need other PHP external modules, configure these modules first.

Cd./php-3.0.x
Cp php3.ini-dist/usr/local/lib/php3.ini
Then, put php3.ini in the specified directory. if necessary, you can manually modify the php3.ini file to meet the usage requirements.

In terms of Apache server configuration, add the following strings to the Apache configuration file httpd. conf or srm. conf. Tell the Apache server that the php3 extension is a special program file. Of course, the extension can be set to another extension, and some websites set the php program extension to phtml is also a good choice. anyway, it depends on the Webmaster plan.

AddType application/x-httpd-php3. php3 method in PHP 4.x version is basically the same as PHP 3.0.x version, the difference lies in the directory name of PHP 4.x and the Directory of the compiled module is different. In addition, the default extension is also changed from. php3 to. php. Of course, you need to download the PHP 4.x program before installation.

Gzip-dc apache_1.3.x.tar.gz | tar xvf-
Gzip-dc php-4.0.x.tar.gz | tar xvf-


Cd apache_1.3.x
./Configure -- prefix =/www
Cd./php-4.0.x
./Configure -- with-mysql -- with-apache = ../apache_1.3.x -- enable-track-vars
Make
Make install
Cd ../apache_1.3.x
./Configure -- prefix =/www -- activate-module = src/modules/php4/libphp4.a
Make
Make install
Cd./php-4.0.x
Cp php. ini-dist/usr/local/lib/php. ini
Add httpd. conf or srm. conf


AddType application/x-httpd-php. php
AddType application/x-httpd-php-source. phps

In PHP 4.x, a new environment variable configuration item is added to the Apache server.

Php_value [PHP directive name] [value]
Php_flag [PHP directive name] [On | Off]
Php_admin_value [PHP directive name] [value]
Php_admin_flag [PHP directive name] [On | Off]

In PHP 3.0.x, some directories may contain. htaccess files. to use a PHP 4.0.x system, you must remove this file. you can change the file name or delete it directly.

------------------------------------

After everything is configured, run the Apache server again. There is a bin or sbin directory under the Apache Directory, where there will be a shell program of apachectl. enter apachectl restart to restart the Apache server.

Hurry up and watch the hello, world program!


 
Related Article

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.