The mysql+php of lamp

Source: Internet
Author: User
Tags zts
After the article: http://wskfnso.blog.51cto.com/4025557/1761877

Two: Install mariadb10.0.24

1: Install MARIADB, get source program, unzip, create soft connection

[Root@master1 ~]# tar XF mariadb-10.0.24-linux-x86_64.tar.gz-c/usr/local/

[Root@master1 ~]# cd/usr/local/

[Root@master1 local]# ln-sv mariadb-10.0.24-linux-x86_64 MySQL
' MySQL ', ' mariadb-10.0.24-linux-x86_64 '

2: Create MySQL system users and groups

[Root@master1 local]# groupadd-r MySQL
[Root@master1 local]# useradd-r-g MySQL mysql-s/sbin/nologin

3: Set up data directory to store data and change data directory to MySQL users and groups

[Root@master1 local]# Mkdir-pv/mydata/data
[Root@master1 local]# chown-r mysql.mysql/mydata/data/

4: Install the database

[Root@master1 mysql]# scripts/mysql_install_db--datadir=/mydata/data/--user=mysql--basedir=/usr/local/mysql/

5: Provide the configuration file for MySQL and modify the following

[Root@master1 mysql]# CP support-files/my-large.cnf/etc/my.cnf

Thread_concurrency = 2//change to twice times of CPU

Basedir =/usr/local/mysql//Database installation directory
DataDir =/mydata/data//Data Directory
Innodb_file_per_table = ON//Open InnoDB engine
Skip_name_resolve = ON//Skip DNS Resolution

6: Provide startup script and make it boot from start

[Root@master1 mysql]# CP Support-files/mysql.server/etc/rc.d/init.d/mysqld

[Root@master1 mysql]# chkconfig--add mysqld

[Root@master1 mysql]# chkconfig--list mysqld
Mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off

7: Start MySQL

[Root@master1 mysql]# Service mysqld start

8: Modify header and library files

(1): Output MySQL header file to the System header file path/usr/include:

# Ln-sv/usr/local/mysql/include/usr/include/mysql

(2): Output MySQL library file to the system library to find the path:

# echo '/usr/local/mysql/lib ' >/etc/ld.so.conf.d/mysql.conf

The system is then re-loaded into the system library:

# Ldconfig

# Ldconfig-p | grep ' MySQL '

(3): Modify the PATH environment variable so that the system can directly use MySQL related commands

Build the mysql.sh file in the/etc/profile.d/directory! Write the following content:

Export Path=/usr/local/mysql/bin: $PATH

# source Mysql.sh

# touch/etc/profile.d/mysql.sh

# echo "Export Path=/usr/local/mysql/bin: $PATH" >/etc/profile.d/mysql.sh

# source Mysql.sh

9: Delete password User:

mysql> drop user ' @ ' localhost ';

Query OK, 0 rows Affected (0.00 sec)


mysql> drop user ' @ ' localhost.localdomain ';

Query OK, 0 rows Affected (0.00 sec)


mysql> drop user ' root ' @ ' localhost.localdomain ';

Query OK, 0 rows Affected (0.00 sec)


mysql> drop user ' root ' @ ':: 1 ';

Query OK, 0 rows Affected (0.00 sec)


mysql> set password for ' root ' @ ' localhost ' =password (' 123456 ');

Query OK, 0 rows Affected (0.00 sec)


mysql> set password for ' root ' @ ' 127.0.0.1 ' =password (' 123456 ');

Query OK, 0 rows Affected (0.00 sec)


Three: Install php5.6

Description

--enable-maintainer-zts

(1): To support Apache worker or event 2 MPM, compile-time using--enable-maintainer-zts

(2): If you use php5.3 or above, in order to connect to the MySQL database, you can specify MYSQLND, so that the machine does not need to install MySQL or MySQL to start the package. Mysqlnd is available from php5.3 and can be bound to it at compile time. (instead of relying on other specific databases).

Starting with php5.4 is the default setting.

#./configure--with-mysql=mysqlnd--with-pdo-mysql=mysqld--with-mysqli=mysqld


LAMP: Note The main points:

Apache connects PHP with 3 different ways

(1) Module mode: The Prefork process is used only with the libphp5.so module. If it's working on a work,event thread, it's libphp5-zts.so.

(2) GGI

(3): FastCgi socket Communication PHP-FPM


1: Install PHP

[Root@master1 ~]# Tar XF php-5.6.18.tar.gz
[Root@master1 ~]# CD php-5.6.18

[Root@master1 php-5.6.18]#./configure--prefix=/usr/local/php--with-mysql=mysqlnd--with-pdo-mysql=mysqlnd-- With-mysqli=mysqlnd--with-openssl--enable-mbstring--with-freetype-dir--with-jpeg-dir--with-png-dir--with-zlib- -WITH-LIBXML-DIR=/USR--enable-xml--enable-sockets--with-apxs2=/usr/local/httpd/bin/apxs--with-mcrypt-- With-config-file-path=/etc--WITH-CONFIG-FILE-SCAN-DIR=/ETC/PHP.D--with-bz2--enable-maintainer-zts

[Root@master1 php-5.6.18]# make && make install


2: Provide configuration file for PHP

[Root@master1 php-5.6.18]# CP Php.ini-production/etc/php.ini

3: Edit Apache config file httpd.conf. To support PHP

# vim/etc/httpd/httpd.conf

Add the following content:

AddType application/x-httpd-php. php

AddType Application/x-httpd-php-source. Phps

4: Set to DirectoryIndex index.html add index.php support PHP


Four: Install XCache for PHP acceleration

1: Install XCache

Root@master1 ~]# Tar XF xcache-3.2.0.tar.gz

[Root@master1 ~]# CD xcache-3.2.0

[Root@master1 xcache-3.2.0]#/usr/local/php/bin/phpize
Configuring for:
PHP Api version:20131106
Zend Module Api no:20131226
Zend Extension Api no:220131226
[Root@master1 xcache-3.2.0]#./configure--enable-xcache--with-php-config=/usr/local/php/bin/php-config

[Root@master1 xcache-3.2.0]# make && make install


At the end of the installation, a line similar to the following appears:

Installing Shared extensions:/usr/local/php/lib/php/extensions/no-debug-zts-20131226/


2: Integrate XCache and PHP, first import the sample configuration provided by XCache into php.ini

# MKDIR/ETC/PHP.D

# CP XCACHE.INI/ETC/PHP.D

Description: The Xcache.ini file is in the XCache source directory.


3: Next edit/etc/php.d/xcache.ini, find a line similar to the beginning of zend_extension, and modify it to the following line:

Extension =/usr/local/php/lib/php/extensions/no-debug-zts-20131226/xcache.so

Note: If you have more than one zend_extension line in the php.ini file, make sure that this new row is ranked first

4:HTTPD Reboot Loading module

  • 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.