Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Centos7 installs apache+mysql+php environment

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Environment:

Centos 7.0

Apache 2.2.27

Mysql 5.1.72

libiconv 1.14

##Apache Please use your own compiler to install. Content copied from my own word, wold inside is good, some places copied overlap, pay attention when watching

1 Unzip MySQL

tar zxvf mysql-5.1.72.tar.gz

cd mysql-5.1.72/

[root@fangshaoxia support-files]# useradd-M -s /sbin/nologin mysql

2 Create a new file and fill in the following parameters, which can be copied directly. The parameters depend on personal needs. These are not necessary. 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

Tip:

checkingfor termcap functions library... configure: error: No curses/termcap libraryfound

Solution: yum install ncurses-static.x86_64 -y

[root@fangshaoxia mysql-5.1.72]# echo $?

0

##Check if there is an error, if it is non-zero, there is an error

[root@fangshaoxia mysql-5.1.72]# make

[root@fangshaoxia mysql-5.1.72]# echo $?

[root@fangshaoxia mysql-5.1.72]#make install

[root@fangshaoxia mysql-5.1.72]# echo $?

[root@fangshaoxia mysql-5.1.72]# cd support-files/

[root@fangshaoxia support-files]# cp my-medium.cnf /etc/my.cnf

[root@fangshaoxia support-files]# cd /application/

[root@fangshaoxia application]# ln -s /application/mysql5.1.72/ mysql

##Tuning to version number

[root@fangshaoxia bin]# cd /application/mysql/bin/

[root@fangshaoxia bin]# mkdir /application/mysql/data -p

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

[root@fangshaoxiabin]#./ mysql_install_db --basedir=/application/mysql --datadir=/application/mysql/data --user=mysql

Tip: There are other parameters in mysql_install_db that can be passed through "./ mysql_install_db --help", must not forget"./ "

[root@fangshaoxiabin]# cd /application/

[root@fangshaoxiaapplication]# chown -R mysql mysql5.1.72/

[root@fangshaoxiabin]# echo "export PATH=/application/mysql5.1.72/bin/:$PATH" >>/etc/profile

[root@fangshaoxiabin]# source /etc/profile

[root@fangshaoxia support-files]# cd /home/tools/LAMP/mysql-5.1.72/support-files/

[root@fangshaoxiasupport-files]# cp mysql.server /etc/init.d/mysqld

[root@fangshaoxia support-files]# chmod +x /etc/init.d/mysqld

[root@fangshaoxia support-files]#/etc/init.d/mysqld start

[root@fangshaoxia support-files]# chkconfig --add mysqld

[root@fangshaoxia support-files]# chkconfig mysqld on

[root@fangshaoxia support-files]#mysql_secure_installation

Tip: The problems that arise depend on the situation and needs

Two OK's and no other problems are OK, security initialization successful

[root@fangshaoxia support-files]# mysql -uroot -p

##Enter the password set above to enter mysql

Start installing PHP

1 decompression

[root@fangshaoxia LAMP]# tar zxvf php-5.3.27.tar.gz

[root@fangshaoxia LAMP]# tar zxvf libiconv-1.14.tar.gz

[root@fangshaoxia LAMP]# cd libiconv-1.14/

[root@fangshaoxia libiconv-1.14]#./ configure --prefix=/usr/local/libiconv

[root@fangshaoxia libiconv-1.14]#make

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

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

Solution:

[root@fangshaoxia libiconv-1.14]# vim srclib/stdio.in.h

Replace line 698 with: _GL_WARN_ON_USE (gets, "gets is a security hole - use fgetinstead");

#if defined(__GLIBC__)&& ! defined(__UCLIBC__) && !__ GLIBC_PREREQ(2, 16)

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

#endif

##This problem has not been encountered in centos 6.8

[root@fangshaoxia LAMP]# cd php-5.3.27/

[root@fangshaoxia php-5.3.27]# yum install libxml2-devel.x86_64 libxml2.x86_64 openssl-devel.x86_64 libcurl-devel.x86_64 libjpeg-turbo.x86_64 libjpeg-turbo-devel.x86_64 png* libpng-devel.x86_64 freetype.x86_64 freetype-devel.x86_64 libxslt-devel.x86_64 libxslt.x86_64

##The above packages are necessary to install PHP, one cannot be left behind

2 Create a new file and fill in the following parameters, which can be copied directly. The parameters depend on personal needs. These are not necessary. There are many parameters.

[root@fangshaoxia 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

##The apache path and mysql path above must be correct.

[root@fangshaoxiaphp-5.3.27]# make && make installmake

[root@fangshaoxiaphp-5.3.27]# cd /application/

[root@fangshaoxia application]# ln -s php5.3.27/ php

[root@fangshaoxia application]# cd -

/home/tools/LAMP/php-5.3.27

[root@fangshaoxia php-5.3.27]# cp php.ini-production /application/php/lib/php.ini

4 Edit httpd profile

[root@fangshaoxia php-5.3.27]# cd /application/apache/conf/

[root@fangshaoxia conf]# vim httpd.conf

DirectoryIndex index.html index.php

##Add index.php on line 169

AddTypeapplication/x-httpd-php .php .phtml (note spaces in.php and.phtml)

AddTypeapplication/x-httpd-php-source .phps (note the spaces before.phps)

##Add the above two configurations on line 311

Go to the site and add an index.php page to test whether PHP and mysql work OK

vim index.php

[root@fangshaoxia num1]# /application/apache/bin/apachectl graceful

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report