版本:httpd-2.4.34、mysql-5.6.14-linux-glibc2.5-x86_64、php-5.6搭建apachetarxfapr-1.6.3.tar.gz-Cus
版本:httpd-2.4.34、mysql-5.6.14-linux-glibc2.5-x86_64、php-5.6
搭建apache
tar xf apr-1.6.3.tar.gz -C /usr/src/
cd /usr/src/apr-1.6.3/
./configure --prefix=/usr/local/apr/ && make && make install
![](https://img1.php1.cn/3cd4a/24cea/5a0/57b2303eee6c054c.jpeg)
tar xf apr-util-1.5.2.tar.gz -C /usr/src/
cd /usr/src/apr-util-1.5.2/
./configure --prefix=/usr/local/apr-util/ --with-apr=/usr/local/apr/ && make && make install
![](https://img1.php1.cn/3cd4a/24cea/5a0/9713018812e7ada6.jpeg)
yum -y install bzip2 bzip2-devel libmcrypt-devel zlib-devel libxml2-devel libjpeg-devel libjpeg-turbo-devel libiconv-devel freetype-devel libpng-devel gd-devel libcurl-devel libxslt-devel libmcrypt-devel mhash mcrypt openssl-devel
yum -y install pcre*
tar xf httpd-2.4.34.tar.gz -C /usr/src/
cd /usr/src/httpd-2.4.34/
./configure --prefix=/usr/local/apache --enable-so --enable-modules=most --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-pcre --enable-rewrite --syscOnfdir=/usr/local/apache/conf -enable-ssl --enable-cgi --enable-rewrite --enable-modules=most --enable-mpms-shared=all && make && make install
![](https://img1.php1.cn/3cd4a/24cea/5a0/43821ed81c50ae27.jpeg)
vim /usr/local/apache/conf/httpd.conf
![](https://img1.php1.cn/3cd4a/24cea/5a0/24121a15975f3a94.jpeg)
/usr/local/apache/bin/apachectl start
![](https://img1.php1.cn/3cd4a/24cea/5a0/de1ff363354f825f.jpeg)
yum -y install httpd-manual mod_ssl mod_perl mod_auth_mysql
/usr/local/apache/bin/apachectl -t
/usr/local/apache/bin/apachectl restart
systemctl stop firewalld (centos7.4关闭防火墙用这个命令)
setenforce 0 (关闭selinux)
![](https://img1.php1.cn/3cd4a/24cea/5a0/1327ce3bcf36cc34.jpeg)
mysql二进制包的安装
groupadd mysql
useradd -s /sbin/nologin -g mysql -M mysql
tar xf mysql-5.6.14-linux-glibc2.5-x86_64.tar.gz -C /usr/local/
cd /usr/local/
mv mysql-5.6.14-linux-glibc2.5-x86_64 mysql-5.6.14
ln -s mysql-5.6.14 mysql
cd /usr/local/mysql/
/bin/cp support-files/my-default.cnf /etc/my.cnf
mkdir -p /usr/local/mysql/data
chown -R mysql.mysql /usr/local/mysql
yum -y install libaio
yum -y install cpan
yum -y install perl*
/usr/local/mysql/scripts/mysql_install_db --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --user=mysql
![](https://img1.php1.cn/3cd4a/24cea/5a0/dfee6f1a7c31169d.jpeg)
cp support-files/mysql.server /etc/init.d/mysqld
chmod +x /etc/init.d/mysqld
/etc/init.d/mysqld start
netstat -antup | grep mysql
ln -s /usr/local/mysql/bin/* /usr/local/bin/
mysqladmin -u root password '123123'
mysql -uroot -p123123
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo
wget -O /etc/yum.repos.d/163.repo http://mirrors.163.com/.help/CentOS6-Base-163.repo 公网源
yum -y install zlib-devel libxml2-devel libjpeg-devel libjpeg-turbo-devel libiconv-devel
rpm -qa zlib-devel libxml2-devel libjpeg-devel libjpeg-turbo-devel libiconv-devel
yum -y install freetype-devel libpng-devel gd libcurl-devel libxslt-devel
rpm -qa freetype-devel libpng-devel gd libcurl-devel libxslt-devel
useradd -M www -s /sbin/nologin
tar xf libiconv-1.15.tar.gz -C /usr/src/
cd /usr/src/libiconv-1.15/
./configure --prefix=/usr/local/libiconv && make && make install
![](https://img1.php1.cn/3cd4a/24cea/5a0/2ca8f7516012a74d.jpeg)
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo
yum -y install libmcrypt-devel
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo
yum -y install mhash
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo
yum -y install mcrypt
tar xf php-5.6.37.tar.xz -C /usr/src/
cd /usr/src/php-5.6.37/
./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --with-mysqli --with-pdo-mysql --with-iconv-dir=/usr/local/libiconv/ --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr/ --enable-xml --disable-rpath --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-fpm --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --enable-short-tags --enable-zend-multibyte --enable-static --with-xsl --with-fpm-user=www --with-fpm-group=www --enable-ftp --with-apxs2=/usr/local/apache/bin/apxs
![](https://img1.php1.cn/3cd4a/24cea/5a0/ecd7a8483fc9f682.jpeg)
ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /usr/lib64/
make
![](https://img1.php1.cn/3cd4a/24cea/5a0/f9bf6fa868f95340.jpeg)
make install
![](https://img1.php1.cn/3cd4a/24cea/5a0/6c1833945dc73984.jpeg)
ln -s /usr/local/php-5.6.37/ /usr/local/php
cp php.ini-production /usr/local/php/lib/php.ini
cd /usr/local/php/etc/
cp php-fpm.conf.default php-fpm.conf
/usr/local/php/sbin/php-fpm
ps -ef | grep php-fpm
![](https://img1.php1.cn/3cd4a/24cea/5a0/52b699f359ab4dcf.jpeg)
/usr/local/apache/bin/apachectl -M
![](https://img1.php1.cn/3cd4a/24cea/5a0/0fdecc8b74f9c4ec.jpeg)
vim /usr/local/apache/conf/httpd.conf
![](https://img1.php1.cn/3cd4a/24cea/5a0/71f0b719f028dbf1.jpeg)
![](https://img1.php1.cn/3cd4a/24cea/5a0/ca2c5500b160cf0b.jpeg)
![](https://img1.php1.cn/3cd4a/24cea/5a0/106ec52724979fa6.jpeg)
/usr/local/apache/bin/apachectl restart
ln –s /usr/local/apache/bin/apachectl /bin/apachectl
vim /usr/local/apache/htdocs/test.php
phpinfo();
?>
![](https://img1.php1.cn/3cd4a/24cea/5a0/bcc913e05f8b336b.jpeg)
![](https://img1.php1.cn/3cd4a/24cea/5a0/817de1e4c52cc1f3.jpeg)
vim /usr/local/apache/htdocs/mysql.php
//$link_id=mysql_connect('主机名','用户','密码');
$link_id=mysql_connect('localhost','root','123123');
if($link_id){
echo "lijiayan !";
}else{
echo mysql_error();
}
?>
![](https://img1.php1.cn/3cd4a/24cea/5a0/3fea04eeaf0fc224.jpeg)