首页 > linux > thttpd-2.21b php-5.3.3模块

thttpd-2.21b php-5.3.3模块

2010年10月29日 eric 发表评论 阅读评论

由于2.25b+php-5.2.11版本,昨天测试上传有问题·试这改了很多源码,只支持了火狐浏览器上传小文件,而IE浏览器则直接返回该页无法显示,今天下下来 php5.3.3最新版的PHP,看了下thttpd 的源码,只支持thttpd 2.21b.然后就试着安装了下·现在可以了上传了支持 POST上传了!

下载源码包:

thttpd $> wget http://cn2.php.net/get/php-5.3.3.tar.bz2/from/cn.php.net/mirror
thttpd $> wget http://www.acme.com/software/thttpd/thttpd-2.21b.tar.gz

1.安装thttpd php补丁

thttpd $> tar jxvf php-5.3.3.tar.bz2
thttpd $> tar zxvf thttpd-2.21b.tar.gz
thttpd $> cd php-5.3.3
thttpd $> ./configure --prefix=/usr/local/php --with-thttpd=../thttpd-2.21b
thttpd $> make install

2.安装 thttpd

thttpd $> cd thttpd-2.21b
thttpd $> ./configure --prefix=/usr/local/thttpd
thttpd $> sed -i 's#getline#get_line#g' extras/htpasswd.c
#不然会报错,上篇文章已经说原因了
thttpd $> make
thttpd $> mkdir -p /usr/local/thttpd
thttpd $> mkdir -p /usr/local/thttpd/{man,sbin,www,etc,logs}
thttpd $> mkdir -p /usr/local/thttpd/man/{man1,man8}
thttpd $> mkdir -p /usr/local/thttpd/www/cgi-bin
# thttpd-2.21b 版本的安装脚本写的更软弱·所有要手动创建这些目录
thttpd $> make install

3. 创建配置文件

thttpd $> cd /usr/local/thttpd/etc
thttpd $> vim thttpd.conf
port=80
user=www
nochroot
host=0.0.0.0
#vhost
logfile=/usr/local/thttpd/logs/thttpd.log
pidfile=/usr/local/thttpd/logs/thttpd.pid
throttles=/usr/local/thttpd/etc/throttle.conf
urlpat=*.txt|*.mp3
charset=utf-8
dir=/var/www
cgipat=/usr/local/thttpd/www/cgi-bin/*

# 还是老配置··呵呵不解释

thttpd $> vim throttle.conf
*.jpg|*.gif     50000
*.mpg           20000
dir/*           20000

# 限速配置

4.创建启动脚本

thttpd $> vim /etc/init.d/thttpd
#!/bin/bash
COMMAND=/usr/local/thttpd/sbin/thttpd
CONFIG=/usr/local/thttpd/etc/thttpd.conf
PID=`cat /usr/local/thttpd/logs/thttpd.pid`
function_start_thttpd()
{
        printf "Starting THTTPD....\n"
        $COMMAND -C $CONFIG 2>&1 >/dev/null&
}
function_stop_thttpd()
{
        printf "Stoping THTTPD....\n"
        kill $PID
}

if [ "$1" = "start" ]; then
        function_start_thttpd
elif [ "$1" = "stop" ];then
        function_stop_thttpd
else
        printf "Usage: /etc/init.d/thttpd {start|stop}"
fi

5,创建 上传PHP 文件测试上传

thttpd $> cd /var/www
thttpd $> vim index.html
<html>
<body>

<form action="/upload_file.php" method="post" enctype="multipart/form-data">
<label for="file">Filename:</label>
<input type="file" name="file" id="file" />
<br />
<input type="submit" name="submit" value="Submit" />
</form>

</body>
</html>

#上传表单

thttpd $> vim upload_file.php
< ?php
if ($_FILES["file"]["error"] > 0)
  {
  echo "Error: " . $_FILES["file"]["error"] . "";
  }
else
  {
  echo "Upload: " . $_FILES["file"]["name"] . "";
  echo "Type: " . $_FILES["file"]["type"] . "";
  echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb";
  echo "Stored in: " . $_FILES["file"]["tmp_name"];
  }
?>

##上传文件信息~

thttpd 就先搞这么一个段落,以后把他应用到服务器中做下载用~这样可以节省带宽·前端服务器当然还是 nginx+php-fpm

转载请注明:文章转载自:Eric's linux and nginx! (http://www.nginxs.com)
本文地址:http://www.nginxs.com/linux/290.html

分类: linux 标签: , , ,
  1. 2018年1月18日15:35 | #1

    casino games free
    casino games free online
    new usa online casinos
    casino games slots

  2. 2018年1月19日00:35 | #2

    payday loans online
    payday loans
    payday loans online
    payday loans
    payday loans online

  3. 2018年1月19日22:26 | #3

    triple diamond slots 5x
    free casino games vegas world
    online casinos real money
    play slots for real money
    online casinos real money

  4. 2018年1月20日02:58 | #4

    Hello, Neat post. There is an issue along with
    your site in web explorer, may test this? IE still is the market chief and a large component of people will leave out your magnificent writing due to this problem.

  5. 2018年1月20日12:25 | #5

    new usa online casinos 2017
    pogo casino slots
    online casinos 2016
    casino online usa

评论分页
1 ... 3 4 5 290
订阅评论
1+7= (必填)