apache+php32位平台安装
生活随笔
收集整理的這篇文章主要介紹了
apache+php32位平台安装
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
一、 系統配置
1、 禁用IPV6
修改/etc/modprobe.conf文件,加入以下兩行:
alias net-pf-10 off
alias ipv6 off
2、 啟用以下服務 其它服務關閉
acpid 提供高級電源管理
cpuspeed 可以提高系統運行效率
apmd 高級電源管理
crond 執行例行性程序 也就是windows中所謂的計劃任務
iptables 防火墻
kudzu 自動檢測硬件的變更
network 網絡
readahead_early 加快系統啟動
sshd SSH終端服務
syslog 把各類事件寫入系統日志
3、yum配置
vim /etc/yum.repos.d/CentOS-Base.repo,刪除保留至#released updates,
注釋掉mirrorlist這一行,并且將baseurl這一行前面的注釋去掉,更改這一行后面的路徑。
如下所示:
[base]
name=CentOS-$releasever - Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
baseurl=file:///cdrom/Server
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5#released updates
掛載光驅:
mount /dev/cdrom /mnt
yum clean all
yum list
安裝組件:
yum -y groupinstall 'Administration Tools' 'Development Tools' 'Editors' 'Server Configuration Tools' 'System Tools'yum -y install zlib-devel openssl-devel二、系統軟件安裝
將安裝包文件上傳至/tmp目錄:
cd /tmp
解壓work.tar.gz至當前目錄
tar -zxvf work.tar.gz1、install apache
tar -zxvf httpd-2.2.8.tar.gz編輯./build/ap_release.h文件,44行
修改“#define AP_SERVER_BASEPRODUCT\"Apache\"”
為“#define AP_SERVER_BASEPRODUCT\"Microsoft-ISS/5.0\"”.編輯./os/unix/os.h文件,35行
修改“#define PLATFORM\"Unix"”
為“#define PLATFORM"Win32\"”cd httpd-2.2.8
./configure --prefix=/usr/local/apache2 --enable-so --enable-module=so --enable-deflate --enable-mods-shared=all --enable-rewrite --enable-static-support --enable-static-htpasswd --enable-static-htdigest --enable-static-rotatelogs --enable-static-logresolve --enable-static-htdbm --enable-static-ab --enable-static-checkgid --disable-userdir && make && make install && echo $?返回結果如是0則為成功去除Apache版本號的方法是修改配置文件/etc/httpd.conf 找到關鍵字ServerSignature 將其設定為:
ServerSignature off
ServerTokens Prod安裝完成后將啟動服務加裁至自啟動
/usr/local/apache2/bin/apachectl start
查看進程:
ps -ef |grep http
加裁服務至自啟動
vi /etc/rc.local
在最下面加上
/usr/local/apache2/bin/apachectl start2、install mysql
tar -zxvf mysql-5.0.37-linux-i686-glibc23.tar.gz
cp -r mysql-5.0.37-linux-i686-glibc23 /usr/local/mysql
添加mysql用戶和用戶組
useradd mysql
cd /usr/local/mysql
改變data文件夾所有者
chown -R mysql.mysql data
用ll命令查看所有者情況
如果網站數據oho5617復制到了mysql目錄下,則需要更改權限:
chown -R mysql.mysql oho5617
chmod -R 750 oho5617
創建數據庫:
scripts/mysql_install_db --user=mysql
為數據庫創建密碼:
bin/mysqladmin -u root password 'oho2009'
如果出現可讀不可寫的加密情況時用:
bin/mysqladmin -P flash -talbes
用mysql用戶啟動進程
bin/mysqld_safe --user=mysql &
復制配置文件至/etc目錄
cp support-files/my-huge.cnf /etc/my.cnf
cp support-files/mysql.server /etc/rc.d/init.d/mysqld
添加mysqld進程
chkconfig --add mysqld
查看進程
chkconfig --list
如果需要將服務在進程在對應的啟動模式中自動啟動或者不啟動則:
chkconfig --level 3 mysqld on/off(增加進程啟動或者不啟動)
kill -9 進程號,可以殺死進程
啟動mysql服務
service mysqld start3、install curl
tar -zxvf curl-7.17.1.tar.gz
cd curl-7.17.1
./configure --prefix=/usr/local/curl && make && make install4、install libxml2
tar -jvxf libxml2-2.6.24.tar.bz2
cd libxml2-2.6.24
./configure --prefix=/usr/local/libxml2 && make && make install5、install jpeg6
mkdir -p /usr/local/jpeg6/bin && mkdir -p /usr/local/jpeg6/lib && mkdir -p /usr/local/jpeg6/include && mkdir -p /usr/local/jpeg6/man/man1
tar -zxvf jpegsrc.v6b.tar.gz
cd jpeg-6b
./configure --prefix=/usr/local/jpeg6/ --enable-shared --enable-static && make && make install6、install freetype
tar -jvxf freetype-2.3.2.tar.bz2
cd freetype-2.3.2
./configure --prefix=/usr/local/freetype && make && make install7、install zlib
tar -zxvf zlib-1.2.3.tar.gz
cd zlib-1.2.3
./configure --prefix=/usr/local/zlib && make && make install8、install libpng
cd $DIR
tar -zxvf libpng-1.2.16.tar.gz
cd libpng-1.2.16
cp scripts/makefile.std makefile && make && make install9、install gd
tar -zxvf gd-2.0.33.tar.gz
cd gd-2.0.33
./configure --prefix=/usr/local/gd2 --with-png=/usr/local/lib --with-zlib=/usr/local/zlib --with-freetype=/usr/local/freetype --with-jpeg=/usr/local/jpeg6 --with-libxml=/usr/local/libxml2 && make && make install10、install tidy
tar -jxvf tidy-cvs_20070326.tar.bz2
cd tidy-cvs_20070326
./configure --prefix=/usr/local/libtidy && make && make install11、install php
tar -zxvf php-5.2.8.tar.gz
cd php-5.2.8
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --enable-inline-optimization --with-config-file-path=/usr/local/php/lib/ --with-libxml-dir=/usr/local/libxml2 --with-gd=/usr/local/gd2 --with-freetype-dir=/usr/local/freetype/ --with-zlib-dir=/usr/local/zlib/ --with-png-dir --enable-mbstring --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --disable-ipv6 --enable-static --enable-sockets --enable-soap --enable-gd-native-ttf --with-ttf --enable-static --enable-mbstring --with-tidy=/usr/local/libtidy --with-png-dir --enable-zip --with-curl=/usr/local/curl --with-jpeg-dir=/usr/local/jpeg6/ && make && make install安裝php結束后:
重新啟動apache和mysql服務
/usr/local/apache2/bin/apachectl stop
/usr/local/apache2/bin/apachectl start12、下面開始整合php與apache:
vi /usr/local/apache2/conf/httpd.conf
在AddType application/x-gzip .gz .tgz下邊添加
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml注意.php前有一個空格
搜索“AddType text/html .shtml”,搜索結果:
# AddType text/html .shtml
# AddOutputFilter INCLUDES .shtml
把這兩行前面的#去掉。
然后搜索“Options Indexes FollowSymLinks”
在搜索到的那一行后面添加“ Includes”
即將該行改變為 Options Indexes FollowSymLinks Includes
把DirectoryIndex index.html改成
DirectoryIndex index.html index.php修改文件大小限制:
vi /usr/local/php/lib/php.ini
upload_max_filesize = 2M
post_max_size = 8M
將這兩個根據要求改成所需的大小,一般建議為1024M寫個測試頁到web服務器根目錄:/usr/local/apache2/htdocs,若要改變目錄可以在主目錄下自己增加。
<?php
phpinfo();
?>
打開瀏覽器:http://IP地址/測試頁文件名
如果主站文件復制后,需要改變文件權限
chmod -R 777 文件夾名在虛擬機命令行下沒有辦法使用圖開化的瀏覽器,可以進行如下操作:
安裝links
yum install links
links 127.0.0.1/文件名
若看到php信息則成功。13、腳本
Include conf/vh.conf
虛擬機AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
ServerSignature off
ServerTokens Prod
轉載于:https://www.cnblogs.com/yuchunju/archive/2012/06/01/2531054.html
總結
以上是生活随笔為你收集整理的apache+php32位平台安装的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: winform(C#)透明方法
- 下一篇: php安装soap扩展