(实验准备虚拟机1台,httpd,libmcrypt,mhash,mcrypt,php,zendGoadLoader,phpMyadmin软件包)
#还原到mysql或者提起安装好
1号机#
#vim /etc/sysconfig/network-scripts/ifcfg-ens33
BOOTPROTO=static
IPADDR=192.168.1.1 (ESC:wq)保存退出
#ifdown ens33;ifup ens33
#getenforce (显示为disabled)
#systemctl stop firewalld
#mount /dev/cdrom /mnt
#cd /etc/yum.repos.d/
#ls (默认将第一个备份为Centos-Base.repo.bak)
#mv Centos-Base.repo Centos-Base.repo.bak
#vim Centos-Base.repo
【a】
baseurl=file:///mnt
gpgcheck=0 (ESC:wq)保存退出
#yum clean all (清除缓存)
#yum -y install apr apr-devel cyrus-sasl-devel expat-devel libdb-devel openldap-devel apr-util-devel apr-util pcre-devel pcre
#tar zxf /root/Desktop/httpd-2.4.25,tar,gz -C /usr/src
#cd /usr/src/httpd..../
#./configure --prefix=/usr/local/httpd --enable-so --enable-rewrite --enable-charset-lite --enable-cgi && make && make install
#ln -s /usr/local/httpd/bin/* /usr/local/bin
#/usr/local/httpd/bin/apachectl start
#netstat -anput | grep httpd
#netstat -anput | grep mysqld
#yum -y install zlib-devel xz-devel libxml2-devel
#tar zxf /root/Desktop/libmcrypt-2.5.8.tar.gz -C /usr/src
#cd /usr/src/libmcrypt-2.5.8
#./configure && make && make install
#ln -s /usr/local/lib/libmcrypt.* /usr/lib
#tar zxf /root/Desktop/mhash-0.9..tar.gz -C /usr/src
#cd /usr/src/mhash../
#./configure && make && make install
#ln -s /usr/local/lib/libmhash* /usr/lib
#tar zxf /root/Desktop/mcrype...tar.gz -C /usr/src
#cd /usr/src/mcrypt.../
#./configure
#export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH (解决配置报错)
#./configure && make && make installl
#tar zxf /root/Desktop/php-5.5.38.tar.gz -C /usr/src
#cd /usr/src/php-5.5.38/
#./configure --prefix=/usr/local/php5 --with-mcrypt --with-apxs2=/usr/local/httpd/bin/apxs --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-config-file-path=/usr/local/php5 --enable-mbstring && make && make install
#cp /usr/src/php-5.5.38/php.ini-development /usr/local/php5/php.ini
#vim /usr/local/php5/php.ini
680行:default_charset = "utf-8" (去掉;符号)
有:file_uploads = on (允许通过php网页上传文件)
有:upload_max_filesize = zM (允许上传文件大小限制一般稍大一些)
有:max_file_uploads = 20 (每个http最多允许上传数量)
有:post_max_size = 8M (每次通过post提交的数据限制)
202行:short_open_tag = On (允许识别php短语法标记)
extension=php_mysqli.dll (添加mysql支持) (ESC:wq)保存退出
#tar zxf /root/Desktop/zend-loader-php..tar.gz -C /usr/src
#cd /usr/src/zend-loader......../
#cp ZendGuardLoader.so /usr/local/php5/lib/php
#vim /usr/local/php5/php.ini
341行:zend_extension=/usr/local/php5/lib/php/ZendGuardLoader.so
zend_loader.enable=1 (ESC:wq) 保存退出
#vim /usr/local/httpd/conf/httpd.conf
259行:DirectoryIndex index.html index.php (在html后面添加index.php)
397行:在AddType application/x-gzip .gz .tgz(下面添加)
AddType application/x-httpd-php .php (ESC:wq) 保存退出
#/usr/local/httpd/bin/apachectl restart
#vim /usr/local/httpd/htdocs/test.php
<?php
phpinfo();
?> (ESC:wq) 保存退出
(在网页输入127.0.0.1/test.php 出现页面为正确)
#vim /usr/local/httpd/htdocs/test1.php
<?php
$link=mysqli_connect('localhost','root',' ');
if($link) echo "it's ok";
mysqli_close($link);
?> (ESC:wq) 保存退出
(在网页输入127.0.0.1/test1.php 出现页面为正确)
#tar zxf /root/Desktop/phpMyAdmin---tar.gz -C /usr/src
#/cd /usr/src
#mv phpMyAdmin..... /usr/local/httpd/htdocs/phpMyAdmin
#cd /usr/local/httpd/htdocs/phpMyAdmin
#cp config.sample.inc.php config.inc.php
#mysqladmin -u root -p password ‘123456’;(出现password直接回车)
(在网页输入127.0.0.1/phpMyAdmin 出现页面为正确)