1. Check system version
[niemx@localhost ~]$ cat /etc/redhat-release
CentOS Linux release 7.6.1810 (Core)
2, install the software ready
(1) Apr 1.5.2.tar.bz2
Apache Portable Runtime (APR) is an Apache web server support library. It provides a set of maps to the underlying operating system (OS), application programming interfaces (API). If the operating system does not support a particular function, APR will provide a simulation. Therefore, the programmer can use the APR for transplant programs across different platforms. APR for Tomcat is the biggest role socket scheduling.
Download http://archive.apache.org/dist/apr/apr-1.5.2.tar.bz2
(2) apr-util-1.5.4.tar.bz2
apr and apr-util are provided for the upper application runtime. Providing the operating system data structures and interface package C does not stl library. Apparently many of the software are based on the apache apr / apr-util-based library development. apr-util only provides more operating system data structures and package interface only on the basis of apr.
Download http://archive.apache.org/dist/apr/apr-util-1.5.4.tar.bz2
(3)pcre-8.43.tar.gz
PCRE (PerlCompatibleRegularExpressions) is a Perl library, including perl-compatible regular expression library. These use when performing regular expression pattern matching using the same syntax and semantics Perl5 is useful. httpd build process need to rely on pcre-devel package.
Download https://ftp.pcre.org/pub/pcre/pcre-8.43.tar.gz
(4)httpd-2.4.41.tar.gz
httpd for the Apache HTTP server program. Direct execution of the program can start the server service.
Download http://www.apache.org/dist/httpd/httpd-2.4.41.tar.gz
(5) mysql-5.6.25.tar.gz
First check the linux version of the system to select the corresponding source package mysql download source packages.
[niemx@localhost ~]$ uname -a
Linux localhost.localdomain 3.10.0-957.10.1.el7.x86_64 #1 SMP Mon Mar 18 15:06:45 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
Download https://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.46.tar.gz
(6)php-5.6.37.tar.bz2
Download https://www.php.net/distributions/php-5.6.37.tar.bz2
** direct download linux source packages may be slower, you can download good in the windows, and then install lrzsz, use SecureCRT transferred to the linux server **
3, compile and install apache
(1) Installation apr
[mysqld]
server_id=1
port=3306
basedir=/usr/local/mysql
datadir=/usr/local/mysql/data
socket=/usr/local/mysql/mysql.sock
log_bin=/usr/local/mysql/mysql-bin
log_error=/var/log/mysql.log
character-set-server=utf8
[client]
socket=/usr/local/mysql/mysql.sock
Forgot your password for the mysql
vi /etc/my.cnf
in the last line added on: skip-grant-tables
to save and exit and restart mysql,
mysql> use mysql;
mysql> UPDATE user SET authentication_string = password ( 'root') WHERE User = 'root'; (no version of the password field) // new password characters in single quotation marks to be set even
mysql> update user set password = password ( 'root') where user = 'root'; (versioned password field)
mysql>quit;
/Etc/my.cnf delete files inside the "skip-grant-tables". The final restart, enter the new password on it.
5, compile and install PHP
(1) resolve dependencies
# yum -y install bzip2-devel libmcrypt-devel libxml2-devel
Installation libmcrypt-devel configure source epel
# rpm -Uvh https://mirrors.tuna.tsinghua.edu.cn/epel/7/x86_64/Packages/e/epel-release-7-12.noarch.rpm
# yum clean all
# yum makecache
# yum update
# yum install -y libmcrypt-devel
(2) installed php
# Tar -xjvf php-5.6.37.tar.bz2
# cd php-5.6.37
# ./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --with-openssl --with-mysqli=/usr/local/mysql/bin/mysql_config --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/apache/bin/apxs --with-mcrypt --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d --with-bz2 --enable-maintainer-zts
# make && make install
(3) modify the configuration
# Cp php.ini-production /etc/php.ini
# vim /etc/httpd/httpd.conf
<IfModule unixd_module>
...
User apache
Group apache
...
</IfModule>
<IfModule dir_module>
DirectoryIndex index.php index.html
</IfModule>
<IfModule mime_module>
...
AddType application/x-httpd-php .php
...
</IfModule>
Httpd restart
# service httpd restart
------------------------------------------------------------------
**/usr/local/apache/bin/apachectl: line 95: lynx: command not found**
Error solution: # yum install lynx -y
-----------------------------------------------------------------
(4) writing test code