您好,登錄后才能下訂單哦!
環境信息介紹:
系統信息:CentOS release 6.6 (Final)2.6.32-504.el6.x86_64 x86_64 (獲取方法 : cat/etc/redhat-release ;uname -r ;uname -m)
IP 地址 :172.16.6.61/16
apache 版本Apache/2.4.10
數據庫版本:mariadb-5.5.43-linux-x86_64.tar.gz
xcache版本:xcache-3.2.0.tar.bz2
PHP版本:php-5.4.40.tar.bz2
安裝開發工具
yum groupinstall "Development tools" "Server Platform Development"
#安裝apr
tar xvf apr-1.5.0.tar.bz2
cd apr-1.5.0
./configure--prefix=/usr/local/apr
make && make install
cd ..
安裝apr-util
tar xvfapr-util-1.5.3.tar.bz2
cd apr-util-1.5.3
./configure--prefix=/usr/local/apr-util --with-apr=/usr/local/apr
cd ../
make && make install
安裝httpd-2.4.10
#解決pcre的依賴關系
yum install pcre-devel -y
tar xvf httpd-2.4.10.tar.bz2
cd httpd-2.4.10
./configure--prefix=/usr/local/httpd24 --enable-so --enable-ssl --enable-cgi--enable-rewrite --with-zlib --with-pcre --with-apr=/usr/local/apr--with-apr-util=/usr/local/apr-util --enable-modules=most--enable-mpms-shared=all --with-mpm=event
make && make install
cd ../
#添加運行mysql的用戶和用戶組
groupadd -g 306 mysql
useradd -r -u 306 -g 306 -s/sbin/nologin mysql
id mysql
#uid=306(mysql)gid=306(mysql) groups=306(mysql)
安裝mariadb
tar xvfmariadb-5.5.43-linux-x86_64.tar.gz -C /usr/local/
cd /usr/local/
#創建符號鏈接
ln -smariadb-5.5.43-linux-x86_64 mysql
ls -lh mysql
#lrwxrwxrwx 1 root root 27May 3 19:54 mysql ->mariadb-5.5.43-linux-x86_64
cd mysql/
cp support-files/mysql.server/etc/init.d/mysqld
chmod u+X /etc/init.d/mysqld
#創建數據目錄
mkdir /data/mydata -p
#授權mysql 為mysql數據目錄的的屬主
chown -R root.mysql/usr/local/mariadb-5.5.43-linux-x86_64/
chown mysql.root /data/mydata
#初始化mysql
/usr/local/mysql/scripts/mysql_install_db--user=mysql --datadir=/data/mydata/
修改my.cnf 添加數據目錄的位置
[root@localhost mysql]# vim/etc/my.cnf
[mysqld]
datadir = /data/mydata
###
sed -i '/\[mysqld]\/ adatadir = /data/mydata' /etc/my.cnf
啟動mysql
/etc/init.d/mysqld start
確認當前httpd的MPM模式
#啟動httpd
/usr/local/httpd24/bin/apachectlstart
#查看當前http的加載的模塊
/usr/local/httpd24/bin/apachectl-M| grep mpm_
修改為http的MPM的方法
[root@localhost ~]# vim/usr/local/httpd24/conf/httpd.conf
#LoadModule mpm_event_modulemodules/mod_mpm_event.so
LoadModule mpm_prefork_modulemodules/mod_mpm_prefork.so
重啟httpd
[root@localhost ~]#/usr/local/httpd24/bin/apachectl stop
[root@localhost ~]#/usr/local/httpd24/bin/apachectl start
解決PHP rpm包的依賴關系
yum install bzip2-devel -y
yum install -ylibmcrypt-devel
./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
#cpphp的配置文件
#php配置文件 (在php源碼目錄下)
[root@localhost php-5.4.40]#ll php.ini-*
-rw-r--r-- 1 502 games 65429Apr 15 12:16 php.ini-development #開發環境中使用
-rw-r--r-- 1 502 games 65459Apr 15 12:16 php.ini-production #生產環境中使用
#復制php.ini-production到/etc/php/php.ini
mkdir /etc/php
cp php.ini-production/etc/php/php.ini
vim /usr/local/httpd24/conf/httpd.conf
1、添加如下二行
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
2、定位至DirectoryIndex index.html
修改為:
DirectoryIndex index.php index.html
#配置后的結果
grep php /usr/local/httpd24/conf/httpd.conf-n
152:LoadModule php5_module modules/libphp5.so
253: DirectoryIndex index.php index.html
382: AddType application/x-httpd-php .php
383: AddType application/x-httpd-php-source .phps
重啟httpd
[root@localhost htdocs]#/usr/local/httpd24/bin/apachectl stop
[root@localhost htdocs]#/usr/local/httpd24/bin/apachectl start
建立php鏈接mysql的測試頁
cat >/usr/local/httpd24/htdocs/test_mysql.php <<EOP
<?php
$link =mysql_connect('127.0.0.1','root','');
if ($link)
echo "Success...";
else
echo "Failure...";
mysql_close();
?>
<<EOP
tar xvf xcache-3.2.0.tar.bz2
cd xcache-3.2.0
/usr/local/php/bin/phpize
./configure --enable-xcache-with-php-config=/usr/local/php/bin/php-config
make && make install
#在編譯安裝最后
###
#Installing shared extensions: /usr/local/php/lib/php/extensions/no-debug-zts-20100525/
###
mkdir /etc/php.d
cp xcache.ini /etc/php.d/ #在xcache源代碼書目錄下
修改xcache.ini
[root@localhostxcache-3.2.0]# vim /etc/php.d/xcache.ini
修改extension = xcache.so 為
extension =/usr/local/php/lib/php/extensions/no-debug-zts-20100525/xcache.so
重啟httpd
[root@localhost xcache-3.2.0]#/usr/local/httpd24/bin/apachectl stop
[root@localhostxcache-3.2.0]# /usr/local/httpd24/bin/apachectl start
建立php測試頁
cat >/usr/local/httpd24/htdocs/index.php <<EOP
<?php
phpinfo();
?>
<<EOP
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。