Site server Deployment and optimization---1---lamp environment construction (rhel6.5)

Source: Internet
Author: User
Tags php and mysql


RedHat Enterprise 6.5

First step: Install Apache

Yum install-y httpd Install the appropriate package (provided that you need a good yum source)

Service httpd start Apache Services


The default configuration file is:/etc/httpd/conf/httpd.conf

Module configuration file storage directory:/ETC/HTTPD/CONF.D


Note: Apache can expand its functionality by extending the module, usually a module corresponding to a file in the/ETC/HTTPD/CONF.D directory


Part of the configuration of the/etc/httpd/conf/httpd.conf file is explained:

1, admin email address: ServerAdmin [email protected]

2, host name: ServerName www.linuxcast.net:80

3, Directory: DocumentRoot "/var/www/html" can be modified according to their own wishes

4, Directory Control options: <directory "/var/www/html" > </Directory>


Note: Do not forget to restart the service after you modify the configuration file: Service httpd restart

Version of Apache:

[Email protected] ~]# Rpm-qa | grep httpd

Httpd-manual-2.2.15-29.el6_4.noarch

Httpd-devel-2.2.15-29.el6_4.x86_64

Httpd-tools-2.2.15-29.el6_4.x86_64

Httpd-2.2.15-29.el6_4.x86_64

[Email protected] ~]#


Step Two: Install PHP

Yum install-y php


After installation, the/ETC/CONF.D directory will produce php.conf files;

PHP is equivalent to a module of Apache;

Php.conf is the configuration file of the PHP module;

By default Apache support for PHP is in the form of modules, and we become mod-php;

The Libphp5.so module will appear under the/etc/httpd/modules.

The function of the module is to parse the PHP code;

PHP does not have a MySQL module by default.


Build a Web page that tests whether PHP is supported:

vim/var/www/html/index.php

<?php

Phpinfo ();

?>


As soon as PHP is installed, the php.conf file will have the following designation: DirectoryIndex index.php

So when you visit 127.0.0.0, it will automatically index.php the content of reality.

Note: If both index.html and index.php are present, the home page will also display the index.php page content by default.


Version of PHP: php-5.3.3-26.el6.x86_64



Step three: Install MySQL database

Yum install-y mysql-server MySQL

Service mysqld Start


Modify MySQL password: mysqladmin-u root password ' linuxcast '

Login: Mysql-u root-p

Enter Password: XXX


Set up MySQL and httpd boot from

Chkconfig mysqld on

Chkconfig httpd on


After MySQL installation, PHP does not support MySQL, need to install Php-mysql

Yum Install-y Php-mysql

Php-mysql provides an interface between PHP and MySQL, allowing PHP to have access to and link to MySQL features


Restart HTTPD service after installation (service httpd restart)

Visit the index.php page again to see the relevant MySQL module (MySQL module and mysqli module)


After the installation is complete, Apache has support for PHP modules and MySQL


Version of MySQL:

Mysql-5.1.71-1.el6.x86_64

Mysql-server-5.1.71-1.el6.x86_64


Version of Php-mysql:

Php-mysql-5.3.3-26.el6.x86_64



Lamp environment in Redhat Enterprise 6.5 only with the CD-ROM package can be built to complete.


This article is from the "Forest blog" blog, make sure to keep this source http://murongqingqqq.blog.51cto.com/2902694/1537088

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.