apache 编译安装php mysql_编译安装APACHE+PHP+MYSQL
adminjun
qq:279872
網絡技術研究會群:8070045
中國linux公社論壇群:4478487
其實這是我用RouterOS和redhat linux進行pppoe服務器的配置及在readius中進行賬號和MAC地址綁定全文中的一部分,
1 安裝MYSQL
# groupadd mysql
# useradd -g mysql -d /usr/local/mysql/data -M mysql
# tar -zxvf mysql-5.0.27.tar.gz
# cd mysql-5.0.27
./configure --prefix=/usr/local/mysql \ 指定安裝目錄
> --sysconfdir=/etc \ 配置文件的路徑
> --localstatedir=/usr/local/mysql/data \ 數據庫存放的路徑
> --enable-assembler \ 使用一些字符函數的匯編版本
> --with-mysqld-ldflags=-all-static \ 以純靜態(tài)方式編譯服務端
> --with-charset=utf8 \ 添加utf8字符支持
> --with-extra-charsets=all 添加所有字符支持
# make
# make install
# /usr/local/mysql/bin/mysql_install_db
# chown -R mysql:mysql /usr/local/mysql/data
# cp /usr/local/mysql/share/mysql/mysql.server /etc/rc.d/init.d/mysqld
# chkconfig --add mysqld
# cp /usr/local/mysql/share/mysql/my-medium.cnf /etc/my.cnf
2 安裝Apache# tar -zvxf httpd-2.2.3.tar.gz
# cd httpd-2.2.3
# ./configure --prefix=/usr/local/apache --enable-so
# make
# make install
2.安裝apache
./configure --prefix=/usr/local/apache --with-mysql=/usr/local/mysql --enable-track-vars --enable-cgi --enable-so --enable-mods-shared=all --with-config-file-path=/usr/local/apache/conf
--prefix=/usr/local/apache 指定把apahce安裝到/usr/local/apache目錄中;
--enable-cgi 支持CGI;
--with-config-file-path=/usr/local/apache/conf 指定把apache的配制文件放在/usr/local/apache/conf中;比如httpd.conf配制文件就在這個目錄中;
--enable-track-vars 為啟動cookie的get/post等追蹤功能
--enable-so DSO功能
--enable-mods-shared=all 包含所有的模塊為DSO
先安裝支持包(注意安裝順序)
安裝注意事項:?http://www.oklinux.cn/html/other/apache/
以Apache使用php有兩種方式:作為動態(tài)模塊,其在運行狀態(tài)時可以載入到web服務器,或者作為靜態(tài)模塊,其可直接編譯到web服務器代碼中。
對于文本,我們著重于第一種方式。
為了能讓Apache2.0模塊使php動態(tài)載入,Apache服務器必須以動態(tài)共享對象(DSO,Dynamic Shared Object)編譯。
可以通過傳遞 --enable-so 參數到 Apache 2
tar -jxvf httpd-2.2.2.tar.bz2
cd httpd-2.2.2
./configure --prefix=/usr/local/apache2 --enable-so make && make install
//切記要支持Zend Optimizer不可加 --with-mpm=worker選項
這一過程將會設置,編譯,以及將服務器安裝到/usr/local/下。
啟動apache守護進程:
/usr/local/apache2/bin/apachectl start (開啟 start 關閉 stop 重啟 restart)
打開瀏覽器,輸入http://localhost 就能看到一個apache的歡迎頁面了,這表示我們已經成功的安裝了apache2 。
如make install出現問題,可能是缺少編譯器或動態(tài)鏈接庫,可重裝系統(tǒng)解決。
/usr/local/apache2/conf/目錄下conf文件內serverName可修改為127.0.0.1,如出現無法啟動apache服務。
先列出配置gd2需要的網址
gd-2.0.33.tar.gz
www.boutell.com/gd
jpegsrc.v6b.tar.gz
ftp.uu.net/graphics/jpeg
www.ijg.org
libpng-1.2.14.tar.tar
www.libpng.org/pub/png/libpng.html
libpng.sourceforge.net
sourceforge.net/projects/libpng
zlib-1.2.3.tar.gz
www.zlib.net
sourceforge.net/projects/zlib
freetype-2.2.1.tar.gz
www.freetype.org
freetype.sourceforge.net/index2.html
sourceforge.net/projects/freetype
建立初始目錄:
mkdir /usr/local/modules
jpeg目錄
# mkdir /usr/local/modules/jpeg6
# mkdir /usr/local/modules/jpeg6/bin
# mkdir /usr/local/modules/jpeg6/lib
# mkdir /usr/local/modules/jpeg6/include
# mkdir /usr/local/modules/jpeg6/man
# mkdir /usr/local/modules/jpeg6/man/man1
安裝zlib
# tar xzvf zlib-1.2.3.tar.gz
# cd zlib-1.2.3
不要用--prefix自定義安裝目錄,影響gd的安裝
# ./configure
# make
# make install
安裝freetype
# tar xzvf freetype-2.2.1.tar.gz
# cd freetype-2.1.5
# ./configure --prefix=/usr/local/modules/freetype
# make
# make install
安裝libpng
# tar xzvf libpng-1.2.14.tar.tar
不要用--prefix自定義安裝目錄,影響gd的安裝
# cd libpng-1.2.5
# cp scripts/makefile.std makefile
# make
# make install
安裝jpeg
# tar xzvf jpegsrc.v6b.tar.gz
# ./configure --prefix=/usr/local/modules/jpeg6 --enable-shared --enable-static
# make
# make install
安裝GD
# tar xzvf gd-2.0.33.tar.gz
# ./configure --prefix=/usr/local/modules/gd --with-jpeg=/usr/local/modules/jpeg6 --with-png --with-
zlib --with-freetype=/usr/local/modules/freetype
# make
# make install
安裝php
# mkdir /usr/local/php5
# tar -zxvf PHP-5.1.4.tar.gz
# cd php-5.1.4
# ./configure --prefix=/usr/local/php5 \
>--with-mysql=/usr/local/mysql \
>--with-mysqli=/usr/local/mysql/bin/mysql_config \
>--with-apxs2=/usr/local/apache/bin/apxs \
>--with-gd=/usr/local/modules/gd \
>--with-jpeg-dir=/usr/local/modules/jpeg6 \
>--with-zlib \
>--with-png \
>--with-freetype-dir=/usr/local/modules/freetype \
>--with-xmlrpc \
>--with-config-file-path=/usr/local/php5/etc
# make
# make install
# cp ./php.ini-dist /usr/local/php5/etc/php.ini
修改httpd.conf
#vi /usr/local/apache/conf/httpd.conf
加載php模塊,去掉注釋“#”,如沒有此行,請加上。
LoadModule php5_module modules/libphp5.so
加上此兩行
AddType application/x-httpd-php .php .php3
AddType application/x-httpd-php-source .phps
到這里全部的安裝過程已完成。
在這里我遇到一個問題,我的as4安裝時沒有選擇安裝apache服務器,沒想到啟動后,仍然給我裝了。。我暈。所以我
剛剛上面安裝的apache2.2.3版本的不能啟動,提示端口已被默認安裝的apache占用了,所以我們這里還需要修改
Apache的啟動腳本(以源碼方式編譯安裝的Apache是沒有啟動腳本的,但這里由于我的系統(tǒng)默認給我裝了低版本的
apache,同時也就有了啟動腳本,所以我這里只需要修改就行了)
修改啟動腳本
# vi /etc/rc.d/init.d/httpd
啟動腳本(如果你的系統(tǒng)沒有這個腳本,就把下面內容復制到httpd文件中去):
#!/bin/bash
# Startup script for the Apache2.0.X Web Server
# Fixed by Comsenz - Nanu (nanu@discuz.com)
# chkconfig: - 85 15
# Source function library.
. /etc/rc.d/init.d/functions
if [ -f /etc/sysconfig/httpd ]; then
. /etc/sysconfig/httpd
fi
INITLOG_ARGS=""
apachectl=/usr/local/apache2/bin/apachectl
httpd=${HTTPD-/usr/local/apache2/bin/httpd}
prog=httpd
RETVAL=0
start() {
echo -n $"Starting $prog: "
daemon $httpd $OPTIONS
RETVAL=$?
echo
[ $RETVAL = 0 ] && touch /var/lock/subsys/httpd
return $RETVAL
}
stop() {
echo -n $"Stopping $prog: "
killproc $httpd
RETVAL=$?
echo
[ $RETVAL = 0 ] && rm -f /var/lock/subsys/httpd /var/run/httpd.pid
}
reload() {
echo -n $"Reloading $prog: "
killproc $httpd -HUP
RETVAL=$?
echo
}
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status $httpd
RETVAL=$?
;;
restart)
stop
start
;;
condrestart)
if [ -f /var/run/httpd.pid ] ; then
stop
start
fi
;;
reload)
reload
;;
graceful|help|configtest|fullstatus)
$apachectl $@
RETVAL=$?
;;
*)
echo $"Usage: $prog
{start|stop|restart|condrestart|reload|status|fullstatus|graceful|help|configtest}"
exit 1
esac
exit $RETVAL
我這里只需要找到文件中的:
apachectl=/usr/local/apache2/bin/apachectl
httpd=${HTTPD-/usr/local/apache2/bin/httpd}
根據我們自己的安裝情況更改以上兩行中Apache的路徑
授予httpd運行權限
# chmod 755 /etc/rc.d/init.d/httpd
將httpd加入系統(tǒng)SysV服務并設置其開機自啟動
# chkconfig --add httpd
# chkconfig --level 3 httpd on
這樣,今后如需啟動、停止、重啟Apache就可以用以下方式了:
# service httpd start
# service httpd stop
# service httpd restartfreeradius-1.1.3+mac地址綁定 http://linux.chinaunix.net/bbs/viewthread.php?tid=885614&highlight=radius
http://ly.deafstar.net/unix/show.php?id=52
apache+mysql+php+GD+zend+mmcache安裝
安裝Apahe與MySQL,將php安裝成支持gif,png,jpeg,freetype,mysql,需要更強大的圖形處理能力,可安裝ImageMagic。可以分析大流量網站日志(更大流量的網站推薦用Webalizer,不過界面簡陋:-,),同時安裝mmcache+zend來加速度
二、安裝環(huán)境描述
操作系統(tǒng):GNU Linux kernel 2.4.20-8
web服務器:Apache httpd-2.0.50 下載:http://apache.linuxforum.net/dist/httpd/httpd-2.0.50.tar.gz
數據庫服務器:mysql-standard-4.0.20-pc-linux-i686.tar.gz 下載:http://dev.mysql.com/get/Downloads/MySQL-4.0/mysql-standard-4.0.20-pc-linux-i686.tar.gz/from/http://mysql.ihostunit.com/
腳本程序語言:php-4.3.8.tar.gz下載:http://cn2.php.net/get/php-4.3.8.tar.gz/from/cn.php.net/mirror 其它庫文件:
ZLIB:zlib-1.2.1.tar.gz 下載:http://www.zlib.net/zlib-1.2.1.tar.gz
FreeType:freetype-2.1.9.tar.gz??http://sourceforge.net/projects/freetype/
下載:http://umn.dl.sourceforge.net/sourceforge/freetype/freetype-2.1.9.tar.gz
PNG:libpng-1.2.5.tar.gz http://prdownloads.sourceforge.net/png-mng/libpng-1.2.5.tar.gz?download
JPEG:jpegsrc.v6b.tar.gz http://freshmeat.net/projects/libjpeg/ 下載:http://freshmeat.net/redir/libjpeg/5665/url_tgz/jpegsrc.v6b.tar.gz GD:gd-2.0.28.tar.gz 下載:http://www.boutell.com/gd/http/gd-2.0.28.tar.gz 已支持gif
mmcache:http://turck-mmcache.sourceforge.net/index_old.html下載:http://sourceforge.net/project/showfiles.php?group_id=69426 zend: www.zend.com
下載2
一、下載
gd-2.0.33.tar.gz http://www.boutell.com/gd/
jpegsrc.v6b.tar.gz http://www.ijg.org/
libpng-1.2.7.tar.tar http://sourceforge.net/projects/libpng/
zlib-1.2.2.tar.gz http://sourceforge.net/projects/zlib/
freetype-2.1.9.tar.gz http://sourceforge.net/projects/freetype/
php-4.3.9.tar.gz http://www.php.net
三、安裝步驟
1.安裝mysql(由于安裝mysql比較簡單,省略)安裝在/usr/local/mysql目錄
2.安裝apache
./configure --prefix=/usr/local/apache --with-mysql=/usr/local/mysql --enable-track-vars --enable-cgi --enable-so --enable-mods-shared=all --with-config-file-path=/usr/local/apache/conf
--prefix=/usr/local/apache 指定把apahce安裝到/usr/local/apache目錄中;
--enable-cgi 支持CGI;
--with-config-file-path=/usr/local/apache/conf 指定把apache的配制文件放在/usr/local/apache/conf中;比如httpd.conf配制文件就在這個目錄中;
--enable-track-vars 為啟動cookie的get/post等追蹤功能
--enable-so DSO功能
--enable-mods-shared=all 包含所有的模塊為DSO
如果需要更多的選項,可能通過下面的命令來查看;
./configure --help
make
make install
設置成開機自啟動
在/etc/rc.d/rc.local文件中加入一行
/usr/local/apache/bin/apachectl start
這樣每次重新啟動系統(tǒng)以后,apache也會隨系統(tǒng)一起啟動.
3.安裝PHP
A先安裝支持包(注意安裝順序)
建立初始目錄:
mkdir /usr/local/modules
#jpeg目錄
mkdir /usr/local/modules/jpeg6
mkdir /usr/local/modules/jpeg6/bin
mkdir /usr/local/modules/jpeg6/lib
mkdir /usr/local/modules/jpeg6/include
mkdir /usr/local/modules/jpeg6/man
mkdir /usr/local/modules/jpeg6/man/man1
A1、安裝zlib
tar xzvf zlib-1.2.1.tar.gz
cd zlib-1.2.1
#不要用--prefix自定義安裝目錄,影響gd的安裝
./configure
make
make install
A2、安裝freetype
tar xzvf freetype-2.1.5.tar.gz
cd freetype-2.1.5
./configure --prefix=/usr/local/modules/freetype
make
make install
A3、安裝libpng
tar xzvf libpng-1.2.5.tar.gz
#不要用--prefix自定義安裝目錄,影響gd的安裝
cd libpng-1.2.5
cp scripts/makefile.std makefile
make test
make install
A3、安裝jpeg
tar xzvf jpegsrc.v6b.tar.gz
./configure --prefix=/usr/local/modules/jpeg6 --enable-shared --enable-static
make
make install
A4、安裝GD
tar xzvf gd-2.0.28.tar.gz
./configure --prefix=/usr/local/modules/gd --with-jpeg=/usr/local/modules/jpeg6 --with-png --with-zlib --with-freetype=/usr/local/modules/freetype
make
make install
B、安裝PHP
tar xzvf php-4.3.8.tar.gz
cd??php-4.3.8
./configure --prefix=/usr/local/php --with-gd=/usr/local/modules/gd --with-jpeg-dir=/usr/local/modules/jpeg6 --with-zlib --with-png --with-freetype-dir=/usr/local/modules/freetype --enable-magic-quotes --with-mysql=/usr/local/mysql --with-apxs2=/usr/local/apache/bin/apxs --enable-track-vars --enable-force-cgi-redirect --enable-ftp --with-config-file-path=/usr/local/php/etc
一點說明:
--prefix=/usr/local/php 指定把php-4.3.8安裝到/usr/local/php目錄中;
--with-mysql=/usr/local/mysql 指定mysql數據服務器安裝的位置;
--with-apxs2=/usr/local/apache/bin/apxs 這是加入apache中為DSO模塊的位置;
-enable-track-vars 為啟動cookie的get/post等追蹤功能
--with-config-file-path=/usr/local/php/etc 指定php的配制文件存放的目錄是/usr/local/php/etc目錄,我們安裝完成后,也要把php.ini復制到這個目錄中來。
make
make install
cp php.ini-dist /usr/local/php/etc/php.ini
更改apache的配制文件:得加幾行,目的是讓apache能解釋php程序。
查找AddType application/x-tar .tgz??行,在下面添加
AddType application/x-httpd-php .php
AddType application/x-httpd-php .php3
AddType application/x-httpd-php .phtml
AddType application/x-httpd-php-source .phps
找到下面一行在后面加上index.php,這表示網站的默認頁也能夠為index.php
DirectoryIndex index.html index.html.var index.php
進行php.ini文件的配置工作
查找safe_mode=Off,更改為safe_mode=On
1)查找max_execution_time = 30,更改為max_execution_time = 600
(2)查找max_input_time = 60,更改為max_input_time = 600
(3)查找memory_limit = 8M ,更改為memory_limit = 20M
(4)查找display_errors = On,更改為display_errors = Off
(5)查找register_globals = Off,更改為register_globals = On
(6)查找post_max_size = 8M,更改為post_max_size = 20M
(7)查找upload_max_filesize = 2M,更改為upload_max_filesize = 20M
(8)查找session.auto_start = 0,更改為session.auto_start = 1
執(zhí)行:wq!命令保存后退出,從而完成了php.ini文件的配置工作。
C安裝mmcache
Step 1. Compiling Turck MMCache
export PHP_PREFIX="/usr/local/php"
$PHP_PREFIX/bin/phpize
./configure --enable-mmcache=shared --with-php-config=$PHP_PREFIX/bin/php-config
make
提示:You must specify the real prefix where PHP is installed in the "export" command. It may be "/usr" "/usr/local", or something else.
Step 2. Installing Turck MMCache
make install
Step 3. Configuring Turck MMCache
Turck MMCache can be installed both as Zend or PHP extension, so you need to edit your php.ini file (usually /etc/php.ini).
To install as Zend extension:
zend_extension="/usr/lib/php4/mmcache.so"
mmcache.shm_size="16"
mmcache.cache_dir="/tmp/mmcache"
mmcache.enable="1"
mmcache.optimizer="1"
mmcache.check_mtime="1"
mmcache.debug="0"
mmcache.filter=""
mmcache.shm_max="0"
mmcache.shm_ttl="0"
mmcache.shm_prune_period="0"
mmcache.shm_only="0"
mmcache.compress="1"
If you use thread safe build of PHP you must use "zend_extension_ts" instead of "zend_extension".
To install as PHP extension:
extension="mmcache.so"
mmcache.shm_size="16"
mmcache.cache_dir="/tmp/mmcache"
mmcache.enable="1"
mmcache.optimizer="1"
mmcache.check_mtime="1"
mmcache.debug="0"
mmcache.filter=""
mmcache.shm_max="0"
mmcache.shm_ttl="0"
mmcache.shm_prune_period="0"
mmcache.shm_only="0"
mmcache.compress="1"
Step 4. Creating cache directory
mkdir /tmp/mmcache
chmod 0777 /tmp/mmcache
4 安裝Zend
解壓后執(zhí)行install.sh就可以了
http://www.uplinux.com/www/sys/01/79.shtml
架設 web 服務器的支持當然首選 mysql,apache,php,選定軟件后就從本站的下載中心下載了 mysql(2.23.37),apache(1.3.19),php(4.0.5)
來安裝.
我選擇的安裝順序為:1)mysql 2)apache 3)php
可以開始安裝了,在安裝軟件時養(yǎng)成先看看 ./configure --help 的習慣是非常重要的,因為會有新的功能安裝方法提供.一)mysql 的安裝
1.下載軟件包到 /usr/local/src 內
2.解壓軟件包 tar -zvxf mysql-2.23.37.tar.gz
3.進入解壓后的目錄 /usr/local/src/mysql-2.23.37
4.運行安裝配置
#./configure --prefix=/usr/local --with-charset=gb2312 --with-extra-charsets=big5,latin1
配置的第一個參數不用說了,因為我們使用簡體,所以需要優(yōu)化簡體的查詢,我們這也需要對繁體和英文使用,--with-charset 和 --with-extra-char-charsets 就是對這些需要進行配置,好了可以按回車了!
5.編譯 mysql
#make
這各過程是漫長的,可以休息一下或者去做其它的事情直到編譯完成
6.安裝 mysql
#make install
7.安裝 mysql 庫
#cd /usr/local/lib
#./mysql_install_db
8.啟動測試 mysql
#/usr/local/share/mysql/mysql.server start
9.運行 mysql
#/usr/local/bin/mysql
10.為了在任何目錄下鍵入 mysql 都能運行 mysql ,需要將 /usr/local/bin/mysql 移入 /usr/bin 和 /usr/sbin 這兩個目錄下
#cp /usr/local/bin/mysql /usr/bin
#cp /usr/local/bin/mysql /usr/sbin
mysql 安裝完成.^o^
------------------------------------------------------------
二.安裝 apache
1.下載軟件包到 /usr/local/src
2.解壓軟件包
3.建立 apache 目錄
#cd /usr/local
#mkdir apache
4.進入解壓后的目錄位置
#cd /usr/local/src/apache-1.3.19
5.運行安裝配置
#./configure --prefix=/usr/local/apache --enable-module=most --enable-shared=max
注意從這開始與大多數書本和文章介紹的安裝方法不同,不必 php 和 apache 交叉配置,后面會介紹 php 的安裝方法! 這里的配置意思是 apache 進行最大和最多模塊支持安裝
6.編譯 apache
#make
7.安裝 apache
#make install
apache 的安裝完成
------------------------------------------------------------
三.安裝 php
1.下載軟件包到 /usr/local/src
2.解壓軟件包
3.建立 php 的目錄
#cd /usr/local
#mkdir php
4.進入解壓后的目錄位置
#cd /usr/local/src/php-4.0.5
5.運行安裝配置
這里的配置較為復雜:
#./configure --prefix=/usr/local/php --with-apxs=/usr/local/apache/bin/apxs --with-mysql=/usr/local --enable-track-vars --disable-debug
特別要指出的是這配置了 apache 自動加載 php 模塊功能和 mysql 數據庫支持功能
6.編譯 php
#make
7.安裝 php
#make install
php 安裝完成
------------------------------------------------------------
到這 mysql+apache+php 安裝完成.我還會繼續(xù)介紹如何配置 apache 服務器使得 php,mysql 發(fā)揮它們出色的功能
安裝至此完成,可以使用如下命令啟動apache:
server# /usr/local/apache/bin/apachectl start
如果要使用https則使用如下命令啟動:
server# /usr/local/apache/bin/apachectl startssl
(鍵入證書密碼,然后回車)
apache的自起動
設置成開機自啟動
在/etc/rc.d/rc.local文件中加入一行
/usr/local/apache/bin/apachectl start
這樣每次重新啟動系統(tǒng)以后,apache也會隨系統(tǒng)一起啟動.
1 將/usr/local/apache2/bin/apachectl拷貝到/etc/rc.d/init.d/httpd
2,然后在httpd得注釋得開頭改成
#! /bin/sh
# chkconfig 35 70 30
# description apache
保存!
3,/sbin/chkconfig httpd reset
稍微解釋一下上面三步的作用,免得以后自己會忘記
1,將腳本文件考到/etc/rc.d/init.d/httpd,做為服務的啟動腳本,/etc/rc.d/init.d/這個文件夾內的腳本都是啟動時候的服務的
具體參見http://linux.vbird.org/linux_basic/0560daemons.php
2 # chkconfig 35 70 30
# description apache
這兩句的作用是讓chkconfig認的出這個腳本服務的性質
第一個數字35表示在運行級別3和5啟動,如果要在4也啟動那就是345,其他類推
第二個數字表示啟動優(yōu)先級
第三個不大清楚,沒來得及查,好像是kill得優(yōu)先級之類。。
另外在,/etc/rc.d/rc5.d/文件夾里可以看到5這個運行級別得服務
S70httpd表示httpd在5這個級別啟動,優(yōu)先級是70
3這一步后chkconfig可以看到httpd了
也可以用,/sbin/chkconfig --add httpd
下次啟動httpd就可以啟動了(如果要立即啟動用/sbin/service httpd start)
編寫apache的自啟動文件(Freebsd下):
server# edit /usr/local/etc/rc.d/apache-server.sh 示例:apache-server.sh
server# chmod 755 apache-server.sh
重新啟動服務器,Bind9就可以自動運行!
測試服務器:
在/usr/local/apache/htdocs下編輯test.php來測試php是否安裝成功 示例:test.php
phpinfo()
?>
在瀏覽器中的地址欄中輸入:http://www.nankai.edu.cn/test.php即可以顯示php的安裝信息。
如果你使用的是apachects startssl命令啟動的話,你可以
在瀏覽器中的地址欄中輸入:https://www.nankai.edu.cn/test.php來顯示php的安裝信息。
http://it.linuxblog.cn/it/net/linux/2006-07-04/638.html
http://www.dvbbs.net/tech/php/2006041948209.asp
linux下配置APACHE2.0.50+PHP5.0.3+MYSQL4.0.20+GD庫
前些天,升級服務器的時候,因為GD庫的原因.make不了PHP4.3.8 于是就一步步裝了PHP5其實,安裝步驟和PHP4只差一點點而已
如果你機器里原來裝有了PHP或者APACHE的RPM或者低版本.請先刪除
首先,服務器GCC要有,不然什么都不能做.可以用gcc -v來查看是否安裝了GCC,
#gcc -v
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2.3/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --host=i386-redhat-linux
Thread model: posix
gcc version 3.2.3 20030502 (Red Hat Linux 3.2.3-34)
有以上類似信息說明已有GCC,
如果你沒有,請先拿安裝光盤裝好它
請下載以下所有的東西:
httpd-2.0.50.tar.gz
MySQL-client-4.0.20-0.i386.rpm
MySQL-server-4.0.20-0.i386.rpm
php-5.0.3.tar.gz
ZendOptimizer-2.5.3-linux-glibc21-i386.tar.gz
gd-2.0.28.tar.gz
libxml2-2.5.11.tar.gz
zlib-1.2.1.tar.gz
jpegsrc.v6b.tar.gz
libpng-1.2.5.tar.gz
xpm-3.4k-2.i386.rpm
gd-devel-1.8.4-11.i386.rpm
可能你的電腦不需要這么多.但最好都下載吧.
這些我都放在我 FTP里 的soft目錄下,如果你點左邊的<< FTP里 >>看不了,那可能是密碼改了,請看我論壇簽名里的下載信息.
不過,
可能你看到這貼子的時候會有以上軟件新的版本下載了.看著辦吧.
開始裝吧>>>>>>>>>>>>>>>>>>>>>>>>>
先安裝MYSQL 服務器
#rpm -ivh MySQL-server-4.0.20-0.i386.rpm
接著客戶端
#rpm -ivh MySQL-client-4.0.20-0.i386.rpm
安裝好后試試能不能用
#mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 27651 to server version: 4.0.20-standard
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
說明OK
請自己改mysql的密碼
安裝GD庫基本包
#rpm -ivh gd-devel-1.8.4-11.i386.rpm
安裝XPM支持
#rpm -ivh xpm-3.4k-2.i386.rpm
安裝libxml2 (記得PHP5只支持libxml2-2.5.10以上版本)
#tar zxvf libxml2-2.5.11.tar.gz
#cd libxml2-2.5.11
#./configure
#make
#make install
開始裝GD庫支持
-------------------------------------------------------
ZLIB
#tar zxvf zlib-1.2.1.tar.gz
#cd zlib-1.2.1
#./configure
#make
#make install
JPEGSRC
#tar zxvf jpegsrc.v6b.tar.gz
#cd jpegsrc-6b
#./configure
#make
#make install-lib
#make install
LIBPNG
#tar zxvf libpng-1.2.5.tar.gz
#cd libpng-1.2.5
#cp scripts/makefile.linux Makefile
#./configure
#make
#make install-headers
#make install
最后是GD2.*
gd-2.0.28
#tar zxvf gd-2.0.28.tar.gz
#cd gd-2.0.28
#./configure --with-png=/usr/local --with-jpeg=/usr/local --with-freetype=/usr
#make
#make install
----------------------------------------------
上面一切都很順利的話,GD就算成功的安裝上了. 如果有問題,應該是缺少支持包,總之是少什么就下載什么來安裝上.
跟著下來,開始安裝APAHCHE2和PHP5
#tar zxvf httpd-2.0.50.tar.gz
#cd httpd-2.0.50
#./configure --prefix=/usr/local/apache2 --enable-module=so
#make
#make install
#tar zxvf php-5.0.3.tar.gz
#cd php-5.0.3
#./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-jpeg-dir=/usr/local --with-png-dir=/usr/local --with-gd=/usr/local --enable-trace-vars --with-zlib-dir=/usr/local -with-mysql=/var/lib/mysql
#make
#make install
我是把他們分別安裝在/usr/local/apache2 & PHP目錄下的
我原來MAKE PHP4.3.8 的時候,遇到
ext/gd/gd.lo(.text+0x63a): In function `zm_deactivate_gd':
/root/software/php-4.3.8/ext/gd/gd.c:385: undefined reference to `gdFreeFontCache'
collect2: ld returned 1 exit status
make: *** [sapi/cli/php]Error 1
是因為GD庫的freetype沒裝,后來我馬上去下載它安裝.就沒錯誤了
所有的安裝工作做好了,接著我們來配置.
在PHP目錄下運行
#cp php.ini-dist /usr/local/php/lib/php.ini
編輯apache配置文件httpd.conf
#vi /usr/local/apache2/conf/httpd.conf
要改的有如下幾處:
1 在 #AddType application/x-tar .tgz下加一行
#LoadModule php5_module modules/libphp5.so
AddType application/x-httpd-php .php
2 LoadModule php5_module modules/libphp5.so請把上面的#號去掉
3 DirectoryIndex index.html index.html.var在后面加 index.php 讓它把index.php做為默認頁
4 # don't use Group #-1 on these systems!把下面的用戶名和組改為
User apache
Group apache
(原來好像是nobody)
5 #ServerName 把#去掉,后面的IP改成你的IP.
6 DocumentRoot "/usr/local/apache2/htdocs"
把/usr/local/apache2/htdocs改為你存放網頁文件的路徑
比如我是放在/home/easy目錄下,所以我以后上傳PHP文件就放在/home/easy目錄下,然后用IP訪問,就能看到首頁了
7 為了讓中文網頁沒亂碼找到
AddDefaultCharset iso8859-1把后面的iso8859-1改為gb2312
差不多就這些了,至于apache2其它優(yōu)化,請看www.phpv.net 里的apache配置那一分類.
保存httpd.conf文件.
啟動它
# /usr/local/apache2/bin/apachectl start
如果沒有出錯,寫一個測試頁放到你網頁目錄下, 我的就是上面所說的 /home/easy
#vi /home/easy/index.php
phpinfo();
保存.試試在測試器里打IP進去就可以看到PHPINFO頁了.
用ZendOptimizer-2.5.3加速PHP
#tar zxvf ZendOptimizer-2.5.3-linux-glibc21-i386.tar.gz
#cd ZendOptimizer-2.5.3-linux-glibc21-i386
#./install.sh
一路默認下去應該就好了.
再看看測試頁,
找找是不是這樣的?
This program makes use of the Zend Scripting Language Engine:
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies with Zend Extension Manager v1.0.3, Copyright (c) 2003-2004, by Zend Technologies with Zend Optimizer v2.5.3, Copyright (c) 1998-2004, by Zend Technologies
好了,全部的安裝就完成了.
接下來的工作才是最重要的!
那就是如何用PHP5來為我們制作高效率的網站
http://www.linuxpk.com/1254.html
本人最近決定將原 Apache-1.3.27+php-4.1.0+Mysql-3.23.47 更換為 Apache-2.0.43+Php-4.2.3+Mysql-3.23.53,本人原先使用的 php 能提供最大 20M 的文件上載功能,支持 session 。當本人決定更新系統(tǒng)時,到網上查閱了不少文檔,發(fā)現很少有提到成功使用Apache-2.0.43+Php-4.2.3+Mysql-3.23.53,只好自己動手安裝配置,在經過幾次反復設置后,終于成功,現將本人的安裝過程提供給廣大初學者,使大家少走冤枉路,如有不到之處,還請不吝指正。
一、軟件下載
分別下載軟件以下軟件:
Apache-2.0.43 (www.apache.org)
Php-4.2.3 (www.php.net)
Mysql-3.23.53 (www.mysql.com)
二、準備安裝
由于本人將所有軟件的源代碼放置在目錄 /home/src 下 ,安裝目錄為 /server ,下載后的源代碼包在/root目錄下,故執(zhí)行以下操作:
mkdir /home/src
mkdir /server
groupadd mysql
useradd -g mysql -d /home/mysql mysql //建立mysql組及用戶
cd /home/src
tar zxvf /root/mysql-3.23.53.tar.gz
tar zxvf /root/httpd-2.0.43.tar.gz
tar zxvf /root/php-4.2.3.tar.gz
三、安裝配置過程
使用 vi 編輯一 shell 文件,內容如下:
-----------------------------------
cd /home/src/mysql-3.23.53
./configure --prefix=/server/mysql
make
make install
/server/mysql/bin/mysql_install_db
chown -R root /server/mysql
chgrp -R mysql /server/mysql
chown -R root /server/mysql/bin
chgrp -R mysql /server/mysql/bin
chown -R root /server/mysql/var
chgrp -R mysql /server/mysql/var
chmod 777 /server/mysql/var
chown -R root /server/mysql/var/mysql
chgrp -R mysql /server/mysql/var/mysql
chmod 777 /server/mysql/var/mysql
chown -R root /server/mysql/var/mysql/*
chgrp -R mysql /server/mysql/var/mysql/*
chmod 777 /server/mysql/var/mysql/*
chmod 777 /server/mysql/lib/mysql/libmysqlclient.a
#安裝 mysql-3.23.53
cd /home/src/httpd-2.0.43
./configure --prefix=/server/apache --enable-so
make
make install
#安裝 Apache-2.0.43
cd /home/src/php-4.2.3
./configure --with-mysql=/server/mysql --with-apxs2=/server/apache/bin/apxs
--eable-track-vars --enable-force-cgi-redirect --enable-pic
--enable-inline-optimiation --enable-memory-limit --enable-bcmath
--enable-shmop --enable-versioning
-enable-calendar --enable-dbx --enable-dio --enable-mcal
--with-config-file-path=/server/apache/conf
make
make install
cp php.ini-dist /server/apache/conf/php.ini
#安裝php-4.2.3 ,以上某些模塊可不使用,--with-config-file-path=/server/apache/conf 指定
#php的配置文件在目錄 /server/apache/conf
ln -s /server/apache/bin/apachectl /bin/apache
ln -s /server/mysql/bin/mysql /bin/mysql
#創(chuàng)建符號連接
----------------------------------------------------
四、修改配置文件
vi /server/apache/conf/httpd.conf
# 加入以下行(裝載php4模塊并指定.php 文件)
# LimitRequestBody (指定php處理的請求數據大小,以下指定為 20M)
LoadModule php4_module modules/libphp4.so
SetOutputFilter PHP
SetInputFilter PHP
LimitRequestBody 20971520
#注解以下行(在文本前加#),使apache顯示中文,具體原因未知
ForceLanguagePriority Prefer Fallback
AddDefaultCharset ISO-8859-1
#加入默認的引導文件index.php(找到DirectoryIndex,修改如下:)
DirectoryIndex index.html index.html.var index.php
#指定網站目錄(假設為 /apache 目錄)
DocumentRoot "/apache"
vi /server/apache/conf/php.ini
#找到并修改以下參數
max_execution_time = 600 ;最大運行時間 600 秒
max_input_time = 600 ;最大輸出時間 600秒
memory_limit = 20M ;最大內存限制 20M
file_uploads = On ;允許上載文件
upload_max_filesize = 20M ;最大文件大小 20M
post_max_size = 20M ;php可接受的 post 方法大小 20M
session.auto_start = 1 ;session自動啟動
五、運行
#啟動mysql
/server/mysql/bin/safe_mysqld --user=mysql &
#停止mysql
/server/mysql/bin/mysqladmin shutdown
#啟動apache
apache start
#停止apache
apache stop
mkdir /apache
echo "" >/apache/index.php
echo "phpinfo();" >>/apache/index.php
echo "?>" >>/apache/index.php
#生成/apache/index.php 文件
在瀏覽器上輸入 linux 機器網址,php 的配置信息將顯示出來。
http://www.ayxz.com/info/326.htm
Unix 服務器的安裝與配置 (FreeBSD) 之Apache的完全安裝(apache+php4+mod_ssl+mod_perl+mod_fastcgi+mod_gzip)
本文主要討論源代碼方式的安裝。
從互聯網下載以下幾個程序(本文采用DSO方式安裝),按如下步驟進行處理:
1、apache_1.3.27.tar.gz
2、mod_ssl-2.8.12-1.3.27.tar.gz
3、mod_perl-1.0-current.tar
4、mod_gzip-1.3.26.1a.tar.gz
5、mod_fastcgi-2.4.0.tar.gz
6、php-4.3.1.tar.gz
(另需安裝pth-1.4.1.tar.gz、mm-1.1.3.tar.gz、perl-5.6.1.tar.gz、zlib-1.1.4.tar.gz、libpng-1.2.5.tar.gz、png、gettext、freetype、jpeg、gd、gd2)
安裝pth-1.4.1
server# tar zxvf pth-1.4.1.tar.gz
server# cd pth-1.4.1
server# ./configure --enable-pthread
server# make
server# make test
server# make install
安裝mm-1.1.3
server# tar zxvf mm-1.1.3.tar.gz
server# cd mm-1.1.3
server# ./configure --disable-shared
server# make
server# make test
server# make install
安裝perl-5.6.1
server# tar zxvf perl-5.6.1.tar.gz
server# cd perl-5.6.1
server# sh Configure -de
server# make
server# make test
server# make install
安裝zlib-1.1.4
server# tar zxvf zlib-1.1.4.tar.gz
server# cd zlib-1.1.4
server# ./configure
server# make test
server# make install
安裝libpng-1.2.5 (need zlib-1.1.4、png)
server# pkg_add png-version
server# tar zxvf libpng-1.2.5.tar.gz
server# cd libpng-1.2.5
server# cp scripts/makefile.freebsd makefile
server# make
server# make test
server# make install
安裝apache_1.3.27 + mod_ssl-2.8.12-1.3.27 (need OpenSSL、MM、Prel_5.6.0) + mod_perl-1.0-current
1、解壓縮包(以下文件解壓在同一個目錄下)
server# tar zxvf apache_1.3.27.tar.gz
server# tar zxvf mod_ssl-2.8.12-1.3.27.tar.gz
server# tar zxvf mod_perl-1.0-current.tar
2、配置mod_ssl-2.8.12-1.3.27
server# cd mod_ssl-2.8.12-1.3.27
server# ./configure --with-apache=../apache_1.3.27 \
--with-mm=../mm-1.1.3 \
--prefix=/usr/local/apache \
--enable-shared=ssl
server# cd ..
3、配置安裝mod_perl-1.27
server# cd mod_perl-1.27
server# perl Makefile.PL EVERYTHING=1 APACHE_SRC=../apache_1.3.27/src USE_APACI=1 PREP_HTTPD=1 DO_HTTPD=1 (Freebsd 4.7下有兩處錯誤提示,忽略)
server# make
server# make install
server# cd ..
4、配置安裝apache_1.3.27
server# cd apache_1.3.27
server# ./configure --prefix=/usr/local/apache \
--enable-module=ssl \
--activate-module=src/modules/perl/libperl.a \
--enable-module=most \
--enable-shared=max
server# make
server# make certificate(生成證書,按提示選擇,并記下密碼)
server# make install
安裝mod_gzip-1.3.26
server# tar zxvf mod_gzip-1.3.26.1a.tar.gz
server# cd mod_gzip-1.3.26.1a
server# edit Makefile(將APXS的路徑 APXS?=/usr/local/sbin/apxs 改成apache安裝路徑: APXS?=/usr/local/apache/bin/apxs)
server# make
server# make install
安裝mod_fastcgi-2.4.0
server# tar zxvf mod_fastcgi-2.4.0.tar.gz
server# cd mod_fastcgi-2.4.0
server# /usr/local/apache/bin/apxs -o mod_fastcgi.so -c *.c
server# /usr/local/apache/bin/apxs -i -a -n fastcgi mod_fastcgi.so
安裝php-4.3.1 (need gettext、freetype、jpeg、gd、gd2、png、這里假設mysql已經安裝并運行)
server# pkg_add gettest-version
server# pkg_add jpeg-version
server# pkg_add gd-version
server# pkg_add gd2-version
server# tar zxvf php-4.3.1.tar.gz
server# cd php-4.3.1
server# ./configure --with-apxs=/usr/local/apache/bin/apxs \
--with-config-file-path=/usr/local/apache/conf \
--with-mysql=/usr/local/mysql --with-mysql-sock=/tmp/--enable-versioning \
--enable-ftp --enable-bcmath --disable-debug --enable-memory-limit=yes \
--enable-track-vars --enable-sysvsem --enable-sysvshm --with-gettext \
--enable-trans-sid --enable-fastcgi --with-tsrm-pth=pth-config \
--with-freetype-dir=/usr/local --with-jpeg-dir=/usr/local --with-gd=/usr/local \
--enable-gd-native-ttf --with-png-dir=/usr/local --with-zlib=/usr/local \
--with-zlib-dir=/usr/local --with-mm=/usr/local --with-openssl --with-iconv
server# make
server# make install
server# cp php.ini-dist /usr/local/apache/conf/php.ini
配置apache是其支持php,及php.ini文件:
在/use/local/apache/conf下有這兩個文件:
1、/usr/local/apache/conf/httpd.conf 示例:httpd.conf
2、/usr/local/apache/conf/php.ini 示例:php.ini
在httpd.conf中添加:
AddType application/x-httpd-php .php .php3
AddType application/x-httpd-php-source .phps
配置php.ini:
upload_tmp_dir /tmp
default_charset gb2312
register_globals On
安裝至此完成,可以使用如下命令啟動apache:
server# /usr/local/apache/bin/apachectl start
如果要使用https則使用如下命令啟動:
server# /usr/local/apache/bin/apachectl startssl
(鍵入證書密碼,然后回車)
編寫apache的自啟動文件(Freebsd下):
server# edit /usr/local/etc/rc.d/apache-server.sh 示例:apache-server.sh
server# chmod 755 apache-server.sh
重新啟動服務器,Bind9就可以自動運行!
測試服務器:
在/usr/local/apache/htdocs下編輯test.php來測試php是否安裝成功 示例:test.php
phpinfo()
?>
在瀏覽器中的地址欄中輸入:http://www.nankai.edu.cn/test.php即可以顯示php的安裝信息。
如果你使用的是apachects startssl命令啟動的話,你可以
在瀏覽器中的地址欄中輸入:https://www.nankai.edu.cn/test.php來顯示php的安裝信息。
Linux下安裝最新Apache2.0.52+PHP5+GD2+MySQL等
由于gd2才開始支持真彩圖片的創(chuàng)建,所以,,升級服務器,因為原來的安裝都是默認的系統(tǒng)安裝,也更因為是個菜鳥,所以,安裝很困難,起初根據網上一些文章在我的red hat A 3 上安裝測試,不過,測試了安裝php4.3.X 和php5.0.X都沒有成功,最后,根據其他人的文章,自己搞了將近3天,終于安裝上了,下面就我安裝中出現的錯誤和過程寫出來和大家分享,以免有像我一樣的菜鳥們走彎路! (我可是兩天多的時間,安裝php的次數不下50次得來的經驗,希望大家多多支持,有錯誤當然歡迎給我指正!轉載請注明來自中國智慧在線(http: //article.21e.cn ,謝謝!),以下經過測試在red hat 9 和red hat A 3上通過!
如果你機器里原來裝有了PHP或者APACHE的RPM或者低版本.你可以現刪除,刪除安裝簡潔一些,不過我的實際操作過程是煤油刪除,而直接安裝的.當然你也可以跟我一樣!
首先,服務器GCC要有,不然什么都不能做.可以用gcc -v來查看是否安裝了GCC,
#gcc -v
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2.3/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --host=i386-redhat-linux
Thread model: posix
gcc version 3.2.3 20030502 (Red Hat Linux 3.2.3-34)
有以上類似信息說明已有GCC,沒有就現安裝吧,至于如何安裝,我就不說了,可以用光盤安裝或者是下載源文件都可以,當然你的版本不一定是3.2.3!
請下載以下所有的東西:
httpd-2.0.X.tar.gz 版本最好是下載最新的啦,下載地址:http://www.apache.org
MySQL-client-4.0.20-0.i386.rpm
MySQL-server-4.0.20-0.i386.rpm(如果你打算升級mysql的話請下載,下載地址:http: //www.mysql.org 當然也是下載最新的版本最好了,由于我不打算安裝mysql,就省略了,安裝的時候的步驟也是先安裝mysql!)
php-5.0.X.tar.gz 下載地址:http://www.php.net
ZendOptimizer-2.5.3-linux-glibc21-i386.tar.gz
zend的最新版安裝是好像有點問題,就下載這個版本就可以,zend用來加速php,你可以選擇不安裝!下載地址:http: //www.zend.com
gd-2.0.28.tar.gz 這個軟件的下載地址,php推薦的是:http://www.boutell.com/gd/ 但是由于某些原因,開發(fā)者不支持gif圖像的創(chuàng)建,這有點不太方便,所以,我下載了個支持gif圖像的,也就是打了gif補丁的:http: //www.rime.com.au/gd/
libxml2-2.X.X.tar.gz 下載地址:
zlib-1.X.X.tar.gz 忘記了,自己找一下吧
jpegsrc.v6b.tar.gz 下載地址:ftp://ftp.uu.net/graphics/jpeg/
libpng-1.2.5.tar.gz 下載地址:http://www.libpng.org/pub/png/libpng.html
freetype2-X.X.tar.gz 下載地址:http://www.fretype.org
xpm-3.4k-2.i386.rpm 忘記了,自己找一下吧
以上都是我下載的官方地址,軟件的版本中的X,你自己看看你想用哪個版,不過最好是用最新穩(wěn)定版本的!如果你以前安裝過上述軟件的其他版本,你也可以選擇不安裝!
安裝MYSQL 服務器:
#rpm -ivh MySQL-server-4.0.20-0.i386.rpm
#rpm -ivh MySQL-client-4.0.20-0.i386.rpm
安裝好后試試能不能用
#mysql 如果設置了密碼后測試方法是(mysql -u root -proot -h localhost 注意的是-p后煤沒有空格,直接跟密碼)
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 27651 to server version: 4.0.20-standard
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
說明可以了!
請自己改mysql的密碼,方法不說了!
安裝XPM
#rpm -ivhxpm-3.4k-2.i386.rpm
安裝libxml
# tar -zxf libxml2-2.6.16.tar.gz
# cd libxml2-2.6.16
# ./configure (xml默認安裝就可以,不要指定路徑了,因為安裝時php可能找不到它,PHP5只支持libxml2-2.5.10以上版本)
# make
# make install
安裝zlib
# tar -zxf zlib-1.2.2.tar.gz
# cd zlib-1.2
# ./configure --prefix=/usr/local/zlib2 (注意,如果您以前沒有安裝zlib,可以不指定路徑,我是沒有刪除以前的低版本才指定的!以下雷同!)
# make
# make install
安裝jpeg
# tar -zxf jpegsrc.v6b.tar.gz
# cd jpeg-6b/
# ./configure --prefix=/usr/local/jpeg6
# make
# make install-lib
如果你選擇默認安裝,可能很順利,指定路徑后,請先創(chuàng)建以下文件夾
錯誤提示:...... /usr/bin/install -c -m 644 jconfig.h /usr/local/jpeg6/include/jconfig.h
/usr/bin/install: 無法創(chuàng)建一般文件‘/usr/local/jpeg6/include/jconfig.h’: 沒有那個文件或目錄
make: *** [install-headers] Error 1
# mkdir /usr/local/jpeg6
# mkdir /usr/local/jpeg6/include
# mkdir /usr/local/jpeg6/lib
# make install-lib
# make install
安裝時如果錯誤提示:
/usr/bin/install: 無法創(chuàng)建一般文件‘/usr/local/jpeg6/lib/libjpeg.a’: 沒有那個文件或目錄
make: *** [install-lib] Error 1
創(chuàng)建如下文件夾:
# mkdir /usr/local/jpeg6/lib
# make install
/usr/bin/install -c cjpeg /usr/local/jpeg6/bin/cjpeg
/usr/bin/install: 無法創(chuàng)建一般文件‘/usr/local/jpeg6/bin/cjpeg’: 沒有那個文件或目錄
make: *** [install] Error 1
# mkdir /usr/local/jpeg6/bin
/usr/bin/install -c -m 644 ./cjpeg.1 /usr/local/jpeg6/man/man1/cjpeg.1
/usr/bin/install: 無法創(chuàng)建一般文件‘/usr/local/jpeg6/man/man1/cjpeg.1’: 沒有那個文件或目錄
make: *** [install] Error 1
# mkdir /usr/local/jpeg6/man
# mkdir /usr/local/jpeg6/man/man1
# make install
好了,直到安裝成功!
安裝libpng:
# tar -zxf libpng-1.2.7-config.tar.gz
# cd libpng-1.2.7-config
# ./configure --prefix=/usr/local/libpng2
# make
# make install
安裝freetype:
# tar -zxf freetype-2.1.9.tar.gz
# cd freetype-2.1.9
# ./configure --prefix=/usr/local/freetype2
# make
# make install
安裝gd庫:
# tar -zxf gd-2.0.26gif.tar.gz
# cd gd-2.0.26gif
# ./configure --prefix=/usr/local/gd2 --with-zlib=/usr/local/zlib2/ --with-png=/usr/local/libpng2/ --with-jpeg=/usr/local/jpeg6/ --with-freetype=/usr/local/freetype2/ (請指定及格插件的安裝路徑,否則安裝php的時候可能出錯!)
# make
# make install
安裝apache,(php5安裝環(huán)境需要apache2.0.46以上版本,下載的時候注意!)
#tar zxvf httpd-2.0.50.tar.gz
#cd httpd-2.0.50
#./configure --prefix=/usr/local/apache2 --enable-module=so
#make
#make install
安裝php5:
# tar -zxf php5-200411260130.tar.gz
# cd php5-200411260130
# ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-jpeg-dir=/usr/local/jpeg6/ --with-png-dir=/usr/local/libpng2/ --with-gd=/usr/local/gd2/ --with-freetype-dir=/usr/local/freetype2/ --enable-trace-vars --with-zlib-dir=/usr/local/zlib2/ -with-mysql=/var/lib/mysql
# make
# make install
# cp php.ini-dist /usr/local/php/lib/php.ini
安裝libxml的時候如果指定了路徑,make的時候可能出錯,所以,我安裝的時候沒指定!
我MAKE PHP4.3.8 和5的時候都遇到:
ext/gd/gd.lo(.text+0x63a): In function `zm_deactivate_gd':
/root/software/php-4.3.8/ext/gd/gd.c:385: undefined reference to `gdFreeFontCache'
collect2: ld returned 1 exit status
make: *** [sapi/cli/php]Error 1
另外還有一個錯誤可能是什么: libphp.lo的錯誤(錯誤當時沒有紀錄,忘記了,大概是!)
是因為GD庫的freetype沒裝,或者是安裝gd庫的時候煤油指定插件的路徑!!
復制PHP.INI文件到正確位置
在PHP目錄下運行
#cp php.ini-dist /usr/local/php/lib/php.ini
編輯apache配置文件httpd.conf
#vi /usr/local/apache2/conf/httpd.conf
要改的有如下幾處:1 #AddType application/x-tar .tgz 下加一行
#LoadModule php5_module modules/libphp5.so
AddType application/x-httpd-php .php
如果你搜索其它地方沒有以下這行
LoadModule php5_module modules/libphp5.so
請把上面的#號去掉
2 找到 DirectoryIndex index.html index.html.var
在后面加 index.php 讓它把index.php做為默認頁
3 找到 # don't use Group #-1 on these systems!
把下面的用戶名和組改為
User apache
Group apache
(原來好像是nobody)
4 #ServerName 把#去掉,后面的IP改成你的IP.
5 找到 DocumentRoot "/usr/local/apache2/htdocs"
把/usr/local/apache2/htdocs改為你存放網頁文件的路徑
6 為了讓中文網頁沒亂碼 找到
AddDefaultCharset iso8859-1
把后面的iso8859-1改為gb2312 或者是干脆off
其他的選項就自己修改吧!或者到http://article.21e.cn 有一個專門的httpd.conf的說明!
保存httpd.conf文件.
啟動apache
# /usr/local/apache2/bin/apachectl start
如果沒有出錯,寫一個測試頁放到你網頁目錄下.訪問就應該可以看到php的版本等信息了!
如無意外.PHP腳本已經可以連接mysql了.
用ZendOptimizer加速PHP
#tar zxvf ZendOptimizer-2.5.3-linux-glibc21-i386.tar.gz
#cd ZendOptimizer-2.5.3-linux-glibc21-i386
#./install.sh
安裝的時候注意輸入正確的安裝apache的路徑等內容!
安裝完畢,再看看phpinfo頁面的zend選項就發(fā)現了!!
如果你以前的apache沒有刪除,而你又想使用# /etc/init.d/httpd restart
這樣重起apache的話,那就修改/etc/init.d/httpd這個文件,修改其中的apahce的三個路徑就可以了!!
apache+php+mysql+gd.......了,恭喜!!
http://www.gbunix.com/bbs/forums.html
http://www.ayxz.com/info/326.htm
Unix 服務器的安裝與配置 (FreeBSD) 之Apache的完全安裝(apache+php4+mod_ssl+mod_perl+mod_fastcgi+mod_gzip)
本文主要討論源代碼方式的安裝。
從互聯網下載以下幾個程序(本文采用DSO方式安裝),按如下步驟進行處理:
1、apache_1.3.27.tar.gz
2、mod_ssl-2.8.12-1.3.27.tar.gz
3、mod_perl-1.0-current.tar
4、mod_gzip-1.3.26.1a.tar.gz
5、mod_fastcgi-2.4.0.tar.gz
6、php-4.3.1.tar.gz
(另需安裝pth-1.4.1.tar.gz、mm-1.1.3.tar.gz、perl-5.6.1.tar.gz、zlib-1.1.4.tar.gz、libpng-1.2.5.tar.gz、png、gettext、freetype、jpeg、gd、gd2)
安裝pth-1.4.1
server# tar zxvf pth-1.4.1.tar.gz
server# cd pth-1.4.1
server# ./configure --enable-pthread
server# make
server# make test
server# make install
安裝mm-1.1.3
server# tar zxvf mm-1.1.3.tar.gz
server# cd mm-1.1.3
server# ./configure --disable-shared
server# make
server# make test
server# make install
安裝perl-5.6.1
server# tar zxvf perl-5.6.1.tar.gz
server# cd perl-5.6.1
server# sh Configure -de
server# make
server# make test
server# make install
安裝zlib-1.1.4
server# tar zxvf zlib-1.1.4.tar.gz
server# cd zlib-1.1.4
server# ./configure
server# make test
server# make install
安裝libpng-1.2.5 (need zlib-1.1.4、png)
server# pkg_add png-version
server# tar zxvf libpng-1.2.5.tar.gz
server# cd libpng-1.2.5
server# cp scripts/makefile.freebsd makefile
server# make
server# make test
server# make install
安裝apache_1.3.27 + mod_ssl-2.8.12-1.3.27 (need OpenSSL、MM、Prel_5.6.0) + mod_perl-1.0-current
1、解壓縮包(以下文件解壓在同一個目錄下)
server# tar zxvf apache_1.3.27.tar.gz
server# tar zxvf mod_ssl-2.8.12-1.3.27.tar.gz
server# tar zxvf mod_perl-1.0-current.tar
2、配置mod_ssl-2.8.12-1.3.27
server# cd mod_ssl-2.8.12-1.3.27
server# ./configure --with-apache=../apache_1.3.27 \
--with-mm=../mm-1.1.3 \
--prefix=/usr/local/apache \
--enable-shared=ssl
server# cd ..
3、配置安裝mod_perl-1.27
server# cd mod_perl-1.27
server# perl Makefile.PL EVERYTHING=1 APACHE_SRC=../apache_1.3.27/src USE_APACI=1 PREP_HTTPD=1 DO_HTTPD=1 (Freebsd 4.7下有兩處錯誤提示,忽略)
server# make
server# make install
server# cd ..
4、配置安裝apache_1.3.27
server# cd apache_1.3.27
server# ./configure --prefix=/usr/local/apache \
--enable-module=ssl \
--activate-module=src/modules/perl/libperl.a \
--enable-module=most \
--enable-shared=max
server# make
server# make certificate(生成證書,按提示選擇,并記下密碼)
server# make install
安裝mod_gzip-1.3.26
server# tar zxvf mod_gzip-1.3.26.1a.tar.gz
server# cd mod_gzip-1.3.26.1a
server# edit Makefile(將APXS的路徑 APXS?=/usr/local/sbin/apxs 改成apache安裝路徑: APXS?=/usr/local/apache/bin/apxs)
server# make
server# make install
安裝mod_fastcgi-2.4.0
server# tar zxvf mod_fastcgi-2.4.0.tar.gz
server# cd mod_fastcgi-2.4.0
server# /usr/local/apache/bin/apxs -o mod_fastcgi.so -c *.c
server# /usr/local/apache/bin/apxs -i -a -n fastcgi mod_fastcgi.so
安裝php-4.3.1 (need gettext、freetype、jpeg、gd、gd2、png、這里假設mysql已經安裝并運行)
server# pkg_add gettest-version
server# pkg_add jpeg-version
server# pkg_add gd-version
server# pkg_add gd2-version
server# tar zxvf php-4.3.1.tar.gz
server# cd php-4.3.1
server# ./configure --with-apxs=/usr/local/apache/bin/apxs \
--with-config-file-path=/usr/local/apache/conf \
--with-mysql=/usr/local/mysql --with-mysql-sock=/tmp/--enable-versioning \
--enable-ftp --enable-bcmath --disable-debug --enable-memory-limit=yes \
--enable-track-vars --enable-sysvsem --enable-sysvshm --with-gettext \
--enable-trans-sid --enable-fastcgi --with-tsrm-pth=pth-config \
--with-freetype-dir=/usr/local --with-jpeg-dir=/usr/local --with-gd=/usr/local \
--enable-gd-native-ttf --with-png-dir=/usr/local --with-zlib=/usr/local \
--with-zlib-dir=/usr/local --with-mm=/usr/local --with-openssl --with-iconv
server# make
server# make install
server# cp php.ini-dist /usr/local/apache/conf/php.ini
配置apache是其支持php,及php.ini文件:
在/use/local/apache/conf下有這兩個文件:
1、/usr/local/apache/conf/httpd.conf 示例:httpd.conf
2、/usr/local/apache/conf/php.ini 示例:php.ini
在httpd.conf中添加:
AddType application/x-httpd-php .php .php3
AddType application/x-httpd-php-source .phps
配置php.ini:
upload_tmp_dir /tmp
default_charset gb2312
register_globals On
安裝至此完成,可以使用如下命令啟動apache:
server# /usr/local/apache/bin/apachectl start
如果要使用https則使用如下命令啟動:
server# /usr/local/apache/bin/apachectl startssl
(鍵入證書密碼,然后回車)
編寫apache的自啟動文件(Freebsd下):
server# edit /usr/local/etc/rc.d/apache-server.sh 示例:apache-server.sh
server# chmod 755 apache-server.sh
重新啟動服務器,Bind9就可以自動運行!
測試服務器:
在/usr/local/apache/htdocs下編輯test.php來測試php是否安裝成功 示例:test.php
phpinfo()
?>
在瀏覽器中的地址欄中輸入:http://www.nankai.edu.cn/test.php即可以顯示php的安裝信息。
如果你使用的是apachects startssl命令啟動的話,你可以
在瀏覽器中的地址欄中輸入:https://www.nankai.edu.cn/test.php來顯示php的安裝信息。
http://sery.blog.51cto.com/10037/5564
apache服務器的最新穩(wěn)定發(fā)布版本是httpd-2.2..0,官方下載地址是:http://httpd.apache.org/download.cgi。我們通過下面的步驟來快速的
搭建一個web服務器。
1、 下載源碼文件httpd-2.2.0.tar.gz 到linux服務器的某個目錄。
2、 解壓文件 # tar zxvf httpd-2.2.0.tar.gz .
3、 配置 # ./c ╟refix=/usr/local/apache //指定安裝目錄,以后要刪除安裝就只需刪除這個目錄。
4、 編譯和安裝。 # make ; make install .
5、 編寫啟動腳本,把它放到目錄 /etc/rc.d/init.d/里,這里取名為httpd,其內容如下:
#!/bin/bash
#descripti server
#chkc 235 98 98
case "$1" in
start)
echo "starting apache daemon..."
/usr/local/apache2/bin/apachectl -k start
;;
stop)
echo "stopping apache daemon..."
/usr/local/apache2/bin/apachectl -k stop
;;
restart)
echo "restarting apache daemon..."
/usr/local/apache2/bin/apachectl -k restart
;;
status)
statusproc /usr/local/apache2/bin/httpd
;;
*)
echo "usage: $0 {start|stop|restart|status}"
exit 1
;;
esac
注意:#descripti server 這一行必須加上,否則在執(zhí)行命令 # chkc ╟add httpd 時會出現“service apache does not support chkc 2345
98 98 表示在執(zhí)行命令 # chkc ╟add httpd 時會在目錄 /etc/rc2.d/ 、/etc/rc3.d/ /etc/rc5.d 分別生成文件 s98httpd和 k98httpd。這
個數字可以是別的。
6、 執(zhí)行命令 # chkc ╟add httpd ,進入目錄/etc/rc3.d/檢查是否生成文件 s98httpd及k98httpd.
7、 啟動服務 # service httpd start .
總結
以上是生活随笔為你收集整理的apache 编译安装php mysql_编译安装APACHE+PHP+MYSQL的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: mysql创建行_如何在MySQL中创建
- 下一篇: mysql设计的步骤_mysql笔记8_