版本: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
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
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
vim /usr/local/apache/conf/httpd.conf
/usr/local/apache/bin/apachectl start
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)
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
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
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
ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /usr/lib64/
make
make install
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
/usr/local/apache/bin/apachectl -M
vim /usr/local/apache/conf/httpd.conf
/usr/local/apache/bin/apachectl restart
ln –s /usr/local/apache/bin/apachectl /bin/apachectl
vim /usr/local/apache/htdocs/test.php
<?php
phpinfo();
?>
vim /usr/local/apache/htdocs/mysql.php
<?php
//$link_id=mysql_connect('主机名','用户','密码');
$link_id=mysql_connect('localhost','root','123123');
if($link_id){
echo "lijiayan !";
}else{
echo mysql_error();
}
?>