Configure the LAMP environment in a red hat Linux-RHCE-5.4

Source: Internet
Author: User
Tags php software
I will introduce how to configure the lamp environment in linux. For the convenience of installing the software, please install the yum tool first, for this yum tool, some people say it is silly to install it. I said that there are such easy-to-use tools and one by one looking for software packages to personally consider the dependencies between software packages! Okay, not much nonsense ~!~ Lamp is the common linux + apache + mysql + php software. We can see which software we have installed. 1. Install mysq first.

I will introduce how to configure the lamp environment in linux. For the convenience of installing the software, please install the yum tool first, for this yum tool, some people say it is silly to install it. I said that there are such easy-to-use tools and one by one looking for software packages to personally consider the dependencies between software packages! Okay, not much nonsense ~!~

Lamp is the common linux + apache + mysql + php software.

1. Install mysql first

Yum install mysql *-y

Hey, you can't deny that the yum tool is easy to use!

Start mysql after successful installation

/Etc/init. d/mysql start

After the first installation, mysql does not have a password, so we can set a password for it.

Mysqladmin-u root password 1234

Logon command:

Mysql-u root-p

Enter the password below.

 

2. install php...

Yum install php *-y

After the installation is successful, we need to change its configuration file.

Vi/etc/php. ini

********************************

Find the region of [msyql] and change the following to OK.

Mysql. default_port = 3306 mysql port. The default value is 3306. Do not leave it blank or write it down.

Msyql. default_host = *** write your local ip address here, because all the services are installed together.

Mysql. default_password = 1234 here is the mysql password

Remove the semicolon in front of extension = msyql. so, that is, comment. However, this statement takes effect.

 

3 and then install httpd

Yum install httpd *-y

Edit configuration file

Vi/etc/httpd/conf/httpd. conf

*********************************

AddType application/x-httpd-php. php

Add modules supported by php5

LoadModule php5_module modules/libphp5.so

Modify Character Set

Adddefacharcharset XX depends on your situation as to the encoding of XX. Below I will send an article about character set garbled, which corresponds to this.

4. Modify the context of the libphp5.so module.

This context is the content of selinux. You can disable it without selinux. For security reasons, we recommend that you do not disable it.

Cd/etc/httpd/modules

Chcon-R-t httpd_modules_t libphp5.so

When you publish a website, check that the folder pointed to by your documentRoot is under/var/www/html by default.

5. permissions and context of your website directory

For example, if my website folder is web

To do this, follow these steps ::

I have written the chmod-R-f 755 web. When I write it myself, check the path.

Chcon-R-t httpd_sys_content_t web

6 vi/etc/resolv. conf

******

Nameserver local ip Address

7. The last step is also the most critical step. At that time, it was very easy to start the apache service for a long time for this buddy ~! Ha

/Etc/init. c/httpd start

Now, let's get there today !~

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.