CENTOS7 Installation mysql+php Environment

Source: Internet
Author: User
Tags openssl php and mysql

Environment:

Centos 7.0

Apache 2.2.27

Mysql 5.1.72

Libiconv 1.14

# #Apache Please use the compilation installation yourself. Content copied from my own word, wold inside is good, and some places copied over overlapping, look at the time to pay attention to

1 extracting MySQL

Tar zxvf mysql-5.1.72.tar.gz

CD mysql-5.1.72/

[[email protected] support-files]# useradd-m-s/sbin/nologin MySQL

2 Create a new file to fill in the following parameters, can be copied directly, parameters to see the individual needs, not necessarily these, there are many parameters.

Vim 1.txt

./configure \

--prefix=/application/mysql5.1.72 \

--with-unix-socket-path=/application/mysql5.1.72/tmp/mysql.sock\

--localstatedir=/application/mysql5.1.72/data\

--enable-assembler \

--enable-thread-safe-client \

--with-mysqld-user=mysql \

--with-big-tables \

--without-debug \

--with-pthread \

--enable-assembler \

--with-extra-charsets=complex \

--with-readline \

--WITH-SSL \

--with-embedded-server \

--enable-local-infile \

--with-plugins=partition,innobase \

--with-mysqld-ldflags=-all-static \

--with-client-ldflags=-all-static

3 start compiling MySQL

Cat 1.txt | Bash

Tips:

Checkingfor termcap Functions Library ... configure:error:No curses/termcap libraryfound

Solution: Yum Install ncurses-static.x86_64-y

[[email protected] mysql-5.1.72]# echo $?

0

# #查看是否有错误, if not 0 indicates an error

[[email protected] mysql-5.1.72]# make

[[email protected] mysql-5.1.72]# echo $?

[[email protected] mysql-5.1.72] #make Install

[[email protected] mysql-5.1.72]# echo $?

[Email protected] mysql-5.1.72]# CD support-files/

[email protected] support-files]# CP my-medium.cnf/etc/my.cnf

[Email protected] support-files]# cd/application/

[Email protected] application]# ln-s/application/mysql5.1.72/mysql

# #调优去版本号

[Email protected] bin]# cd/application/mysql/bin/

[Email protected] bin]# mkdir/application/mysql/data-p

Tip: The path here must be the same as the one compiled above, or it will go wrong.

[Email protected]]#./mysql_install_db--basedir=/application/mysql--datadir=/application/mysql/data--user=m Ysql

Hint: There are other parameters mysql_install_db can be passed "./mysql_install_db--help", must not forget "./"

[[Email protected]]# cd/application/

[[Email protected]]# chown-r MySQL mysql5.1.72/

[Email protected]]# echo "Export path=/application/mysql5.1.72/bin/: $PATH" >>/etc/profile

[[Email protected]]# source/etc/profile

[Email protected] support-files]# cd/home/tools/lamp/mysql-5.1.72/support-files/

[Email protected]]# CP mysql.server/etc/init.d/mysqld

[Email protected] support-files]# chmod +x/etc/init.d/mysqld

[[email protected] support-files]#/etc/init.d/mysqld start

[Email protected] support-files]# chkconfig--add mysqld

[Email protected] support-files]# chkconfig mysqld on

[[email protected] support-files] #mysql_secure_installation

Hint: The problem that arises depends on the situation and the demand

There are two ok, and no other problem is OK, safe initialization succeeded

[Email protected] support-files]# mysql-uroot-p

# #输入前面设置的密码就可以进入mysql了

Start installing PHP below

1 decompression

[Email protected] lamp]# tar zxvf php-5.3.27.tar.gz

[Email protected] lamp]# tar zxvf libiconv-1.14.tar.gz

[Email protected] lamp]# CD libiconv-1.14/

[Email protected] libiconv-1.14]#./configure--prefix=/usr/local/libiconv

[[email protected] libiconv-1.14] #make

Tip: Error./stdio.h:1010:1: Err: ' gets ' undeclared here (not in a function)

_gl_warn_on_use (Gets, "gets is asecurity hole-use fgets instead");

Solve:

[Email protected] libiconv-1.14]# vim Srclib/stdio.in.h

will be 698 code for the line: _GL_WARN_ON_USE (gets, "gets is a security hole - use fgetsinstead"); Replace are:

#if defined (__glibc__) &&!defined (__uclibc__) &&!__glibc_prereq (2, 16)

_gl_warn_on_use (Gets, "gets is asecurity hole-use fgets instead");

#endif

## This question has not been met in centos6.8.


[Email protected] lamp]# CD php-5.3.27/

[email protected] php-5.3.27]# Yum install libxml2-devel.x86_64 libxml2.x86_64 openssl-devel.x86_64 Libcurl-deve l.x86_64 libjpeg-turbo.x86_64 libjpeg-turbo-devel.x86_64 png* libpng-devel.x86_64 freetype.x86_64 freet ype-devel.x86_64 libxslt-devel.x86_64 libxslt.x86_64

# #以上是安装PHP所必须的包, one can't fall

2 Create a new file to fill in the following parameters, can be copied directly, parameters to see the individual needs, not necessarily these, there are many parameters.

[Email protected] php-5.3.27]# vim 1.txt

./configure \

--prefix=/application/php5.3.27 \

--WITH-APXS2=/APPLICATION/APACHE/BIN/APXS \

--with-mysql=/application/mysql \

--WITH-XMLRPC \

--WITH-OPENSSL \

--with-zlib \

--with-freetype-dir \

--WITH-GD \

--with-jpeg-dir \

--with-png-dir \

--with-iconv=/usr/local/libiconv \

--enable-short-tags \

--enable-sockets \

--enable-zend-multibyte \

--ENABLE-SOAP \

--enable-mbstring \

--enable-static \

--ENABLE-GD-NATIVE-TTF \

--with-curl \

--with-xsl \

--ENABLE-FTP \

--with-libxml-dir

# #上面apache的路劲和mysql路径必须正确.

[[Email protected]]# make && make Installmake

[[Email protected]]# cd/application/

[Email protected] application]# ln-s php5.3.27/php

[Email protected] application]# CD-

/home/tools/lamp/php-5.3.27

[email protected] php-5.3.27]# CP Php.ini-production/application/php/lib/php.ini


4 Editing the httpd configuration file

[Email protected] php-5.3.27]# cd/application/apache/conf/

[Email protected] conf]# vim httpd.conf

DirectoryIndex index.html index.php

# #在169行添加index. php

addtypeapplication/x-httpd-php. php. phtml (note. PHP and. phtml spaces)

Addtypeapplication/x-httpd-php-source. PHPS (note the space before PHPS)

650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M01/8F/7D/wKiom1jgdNfgBX8tAAAc8BZuZ4c199.png "title=" 1.png "alt=" Wkiom1jgdnfgbx8taaac8bzuz4c199.png "/>

# #在311行添加上面两个配置

Go to the site to add a index.php page, test PHP and MySQL working status is OK

Vim index.php

<?php

$link _id=mysql_connect (' Host name ', ' user ', ' password ');

$link _id=mysql_connect (' localhost ', ' root ', ' ******* ') or mysql_error ();

if ($link _id) {

echo "Mysqlsuccessful by Fangshaoxiade Lake!";

}else{

Echo Mysql_error ();

}

?>

[Email protected] num1]#/application/apache/bin/apachectl Graceful



CENTOS7 Installation mysql+php Environment

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.