Linux apache MySQL PHP (lamp)

Source: Internet
Author: User
Tags bz2 curl fully qualified domain name

First, MySQL centos6.7 binary installation 5.6

  1. Viewing the system version
    Cat/etc/redhat-release

    2. Download MySQL 5.6 pack

    3. Adding users and Groups


    Groupadd MySQL
    useradd-g MySQL MySQL

    4. Install MySQL to/usr/local/mysql
    Cd/usr/local
    Tar zxvf mysql ......... .........
    5. Change the file name to MySQL after pressing
    MV MySQL ..... mysql.
    6. Modify the MySQL folder and file creator, create group for MySQL note point ...
    CD MySQL
    Chwon-r MySQL.
    Chgrp-r MySQL.
    7. mysql has been installed, but also need to initialize, initialize the MySQL table Test table infaumation table, etc.
    #scripts/mysql_install_db--user=mysql--basedir=/usr/local/mysql--datadir=/usr/local/mysql/data
    8. Modify the configuration file
    CP Support-files/mysql.server/etc/init.d/mysqld
    CP MY.CNF/ETC/MYCNF
    Vi/etc/my.cnf
    Basedir =/usr/local/mysql
    DataDir =/usr/local/mysql/data
    Port = 3306
    server_id = 1
    9. Start the MySQL service
    Ln-s/usr/local/mysql/bin/mysql/usr/bin
    Service mysqld Start
    Mysql> SELECT User,host,password from Mysql.user;
    +------+-----------+----------+
    | user | Host | password |
    +------+-----------+----------+
    | Root |          localhost | |
    | Root |          10-4-5-9 | |
    | Root |          127.0.0.1 | |
    | Root |          :: 1 | |
    | |          localhost | |
    | |          10-4-5-9 | |
    +------+-----------+----------+
    6 rows in Set (0.00 sec)

    mysql> UPDATE mysql.user Set password = password (' gechong ') WHERE user = ' root ';

    mysql> DROP USER ' @localhost;

    mysql> FLUSH privileges;

    Chkconfig--add MYSQLDD
    Chkconfig mysqld on
    Service mysqld Start

Second, Apache deployment installation (firewall 80 port)

Download httpd-2.2.31.tar.bz2 put the httpd-2.2.31.tar.bz2 under the/soft.
[[Email protected] ~] #cd/soft
[[email protected] soft] #tar JXVF httpd-2.2.31.tar.bz2//Unzip the Apache package
[[email protected] soft] #cd httpd-2.2.31//Navigate to the Httpd-2.2.31 folder
[[email protected] httpd-2.2.31] #ls//View the contents of the Display httpd-2.2.31 folder
[Email protected] httpd-2.2.31]#./configure--help | More//View install Apache configuration parameters
[[email protected] httpd-2.2.31]#./configure--prefix=/usr/local/apache--enable-so//Configure Apache Path
[[email protected] httpd-2.2.31] #make//Compile Apache
[[email protected] httpd-2.2.31] #make Install//installation Apache
[[email protected] httpd-2.2.31] #cd/usr/local/apache//Enter Apache directory
[Email protected] apache]# CD conf/
[[email protected] conf] #cp-a httpd.conf httpd.conf-//backup Apache configuration file
[[email protected] conf] #chkconfig--list httpd//See if the HTTPD service already exists
[[email protected] conf] #chkconfig httpd off//Shut down system comes with httpd service if there is httpd service
[[email protected] conf] #service httpd status//view your own httpd service status
[[email protected] conf]#/usr/local/apache/bin/apachectl-k start//linux launch Apache command


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

Encountered error Httpd:could not reliably determine the server ' s fully qualified domain name, using Localhost.localdomain for Serverna I'll remove the #servername localhost:80 annotation inside.

****************************************************************************************************
[[email protected] conf] #netstat-an | GREP:80//See if the linux80 port is turned on
[[email protected] conf] #ps-aux | grep httpd//linux under View Apache process
[[email protected] conf] #cd. /..
[[email protected] local] #cp/usr/local/apache/bin/apachectl/etc/rc.d/init.d/apache//copy Apache boot script
[[email protected] local] #vi/etc/rc.d/init.d/apache//This is the edit Apache startup script
At the beginning of the #! /bin/sh below add
#chkconfig: 2345 85 15
[[email protected] local] #chkconfig--add Apache//Add Apache Service
[[email protected] local] #chkconfig--list Apache//list Apache Service
[[email protected] local] #service Apache stop//Stop Apache Service
[[email protected] local] #netstat-an | GREP:80//Check whether the 80 port of Linux is off
[[email protected] local] #ps-aux | grep httpd//To see if a httpd service exists, and if the previous httpd service starts, the newly added Apache service fails to start
[[email protected] local] #service Apache start//Start Apache Service
Open your server IP address to see if there is an Apache default home page, if so, then congratulations on your Linux installation Apache has succeeded

Iii. Deployment Configuration of PHP

Official website Download phphttp://www.php.net/downloads.php

[Email protected] src]# tar zxf php-5.3.27.tar.gz

[Email protected] src]# CD Php-5.3.27[[email protected] php-5.3.27]#./configure--prefix=/usr/local/php--with-apxs2= /usr/local/apache2/bin/apxs--with-config-file-path=/usr/local/php/etc--with-mysql=/usr/local/mysql-- With-libxml-dir--with-gd--with-jpeg-dir--with-png-dir--with-freetype-dir--with-iconv-dir--with-zlib-dir-- with-bz2--with-openssl--with-mcrypt--enable-soap--enable-gd-native-ttf--enable-mbstring--enable-sockets-- Enable-exif--disable-ipv6

[[email protected] php-5.3.27]# make

[[email protected] php-5.3.27]# make install

[email protected] php-5.3.27]# CP Php.ini-production/usr/local/php/etc/php.ini


when an appropriate installation package error is encountered , find information, install it yourself. bzip2 bzip2-devel libpng libpng-devel freetype freetype-devel

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

Iv. the combination of Apache and PHP

Apache Master configuration file/usr/local/apache/conf/httpd.conf

Vim/usr/local/apache/conf/httpd.conf

309 AddType application/x-compress. Z
310 AddType application/x-gzip. gz. tgz

Add below Line 310

AddType application/x-httpd-php. php

Found in line 167

<ifmodule dir_module>

DirectoryIndex index.html

</IfModule>

Modified as follows

<ifmodule dir_module>

DirectoryIndex index.html index.htm index.php

</IfModule>

Five, Test lamp

Restart Apache

/etc/init.d/apache restart

Test Apache with Curl

[[email protected] ~]# curl localhost

The presence of the above shows that Apache succeeded

Then the test can parse PHP

vim/usr/local/apache/htdocs/ceshi.php

Write

<?php

echo "PHP parsing test";

?>

The following message appears to indicate that the resolution was successful

[Email protected] htdocs]# Curl localhost/ceshi.php
PHP parsing test [[email protected] htdocs]#


At this point, the most basic lamp construction completed, the specific configuration files continue to study


This article from "Little Fart Babe" blog, declined reprint!

Linux apache MySQL PHP (lamp)

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.