Configure the lamp environment in a red hat linux-rhce-5.4

Source: Internet
Author: User
Tags php software
I haven't written about it for a long time. today, I am going to introduce how to configure the lamp environment in linux. for the convenience of installing software, please install the yum tool first, as for the yum tool introduction, I have mentioned in my article. for this yum tool, some people say it is a silly installation. I mean there is such a useful tool...

 

I haven't written about it for a long time. today, I am going to introduce how to configure the lamp environment in linux. for the convenience of installing software, please install the yum tool first, as for the yum tool introduction, I have mentioned in my article that some people say it is silly to install this yum tool. I said there are such useful tools and I will find software packages one by one, consider dependencies between software packages in person! 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: www.2cto.com

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 !~

From early hours of Harvard

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.