Download file (download.php):
<?php
$strAttachmentType = "application/octet-stream";
$strAttachmentName = "test.zip";
$strAttachmentPath = "/home/test/test.zip";Header ("Content-type: ".$strAttachmentType."; name=".$strAttachmentName."; charset=gb2312"); 
header ("Content-Disposition: attachment; filename=".$strAttachmentName); 
header ("Content-Description: ".$strAttachmentType ); 
flush;
readfile($strAttachmentPath);
?>Demo (test.php - 1000 clients try to download file):<script language="javascript">
  <!--
    nIndex = -1;
    while (++nIndex < 1000)
    {
        window.open("download.php");
    }
      //-->
</script>

解决方案 »

  1.   

    啥叫虚拟1000个用户?
    Apache Bench不可以么?
      

  2.   

    loveconan说的没错,用ab.exe就可以了,此命行在apache的安装目录bin下面,
    用 ab -n 1000 -c 100 localhost/dir/xxx.doc 命行可模拟出100个用户同时下载xxx.doc共1000次,由于单台电脑的同时开启线程数有限,所以要几台电脑同时开启ab命令才能达到模拟1000个用户的效果。
      

  3.   

    你的意思是不需要再PHP中写直接配置apache就可以
      

  4.   

    我的理解是你有个下载页面,想测试这个页面的承受能力,既然是测试的话,就不用php代码了,用现成的apache性能测试工具ab就可以了
      

  5.   

    <?php
    $strAttachmentType = "application/octet-stream";
    $strAttachmentName = "test.zip";
    $strAttachmentPath = "/home/test/test.zip";Header ("Content-type: ".$strAttachmentType."; name=".$strAttachmentName."; charset=gb2312"); 
    header ("Content-Disposition: attachment; filename=".$strAttachmentName); 
    header ("Content-Description: ".$strAttachmentType ); 
    flush;
    readfile($strAttachmentPath);
    ?>
    你把这段代码复制后,把test.zip给成的机子上的文件各式,执行一下。有什么问题你就写在这我给你回答
      

  6.   

    这个PHP网站挺不错http://trail.51.net/
      

  7.   

    我要的不是一个页面了下载了。而是想我们经常下载软件的的那样的效果,因为我的测试东西了,所以下载的文件很大。就象有一个downlaod点了以后可以在你自己的机子上可以跳出一个保存页
      

  8.   

    http://www.jiafangyifang.com/news/newsdata/2002_05_13/3/20020513105313.htm
      

  9.   

    你建一个表就行了,你明天做不行行吗?
    在Mysql\bin下有个mysql.exe 执行后输入下列命令
    create database huadian;
    在执行
    use huadian;
    在执行下面时
    CREATE TABLE huadian(
       id int(10) NOT NULL auto_increment,
       name varchar(100) NOT NULL,
       urlpath varchar(20) NOT NULL,
       descib  varchar(500) ,
       PRIMARY KEY (id)
    );
      

  10.   

    Fatal error: Call to undefined function: mysql_connect() in /srv/www/htdocs/index.php on line 15你看一下了就是这个错误了!急
      

  11.   

    mysql_connect(localhost,root,root) 试一下看看
      

  12.   

    你先建一个数据库表
    create table huadian(
     id int(10) unsigned NOT NULL auto_increment,
     name varchar(100) NOT NULL,
     filename varchar(100) NOT NULL,
     urlpath varchar(100) NOT NULL,
     demo varchar(100),
      PRIMARY KEY (id)
    );
      

  13.   

    name是页面上显示的名称,
    filename是文件名称,
    urlpath是放文件的目录名称
    demo是说明
      

  14.   

    文件名index.php<?php// ------------------------- -------- ------------------------- //
    $path = ".";
    include ("./include/header.php");
    include ("./include/config_inc.php");
    // ------------------------- -------- ------------------------- //echo "<title>".$site_name." - 下载系统 -</title>\n";// 程序总数
    mysql_connect($dbhost,$dbuser,$dbpasswd) or die ("数据库连接失败");
    $allsql = "SELECT * FROM $down_table";
    $allresult = mysql_db_query($dbname, $allsql);
    ?><table bgcolor=white bordercolor=black cellspacing=0 cellpadding=2 width=778 align=center border=1 style='border-collapse:collapse;' >
    <tr><td colspan=2 align=left><img src=./images/top10.gif>下载列表</tr>
    <tr>
      <td align=center><strong> 文件
      </strong>
      
      <td align=left><strong>说明  </strong>
    </tr>
    <?php while ($myrow=mysql_fetch_array($allresult)){ ?>  
    <tr>
    <td align=center width=100>
    <a href="<?php echo $myrow[3];?>\<?php echo $myrow[2];?>"><?php echo $myrow[1];?></a>
    </td><td><?php echo $myrow[4];?></tr>
    <?php }?>
    </table>
    <?
    mysql_close();
    // ------------------------- -------- ------------------------- //include ("./include/footer.php");// ------------------------- -------- ------------------------- //?>文件名include下面的header.php
    <html><head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <meta http-equiv="MSThemeCompatible" content="Yes">
    <style type="text/css">
    <!--
    BODY{
    font-family:"宋体";
    font-size: 12px;
    scrollbar-face-color:ffffff;
    scrollbar-shadow-color:C1C1BB;
    scrollbar-highlight-color:C1C1BB;
    scrollbar-3dlight-color:EBEBE4;
    scrollbar-darkshadow-color:EBEBE4;
    scrollbar-track-color:F4F4F0;
    scrollbar-arrow-color:CACAB7;
    margin-left: 0px;
    margin-top: 0px;
    margin-right: 0px;
    margin-bottom: 0px;
    }
    p, input, font, select, option, textarea, form { font-family:"宋体"; font-size: 12px }
    td { table-layout:fixed;word-break :break-all; font-family:"宋体"; font-size: 12px}
    a:link { text-decoration: none ; color:#0000FF  }
    a:visited { text-decoration: none ; color:#0000FF}
    a:hover { text-decoration: underline;color:#FF0000 }
    a:active { text-decoration: none; font-size: 12px; color:#0000FF}
    .border { border-collapse: collapse; border-style: dotted; border-width: 1;  color:#000000; background-color:#efefef}
    .shadow1 { font-size: 12px; filter:dropshadow(color=#000000,offx=1,offy=1);color:#ffffff;}
    .shadow2 { font-size: 12px; filter:dropshadow(color=#d5d5d5,offx=1,offy=1);color:#000000;}
    .p1 { color: #ffffff; font-size: 12px; text-decoration: none; }
    .p2 { color: #000000; font-size: 12px; text-decoration: none; }
    .p3 { color: #004080; font-size: 14px; text-decoration: none; }
    .style2 {font-size: 24px}
    -->
    </style>
    </head><body bgcolor=white text=#000000 link=#000000 vlink=#000000>
    <table width="778" border="1" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <th height="100" align="center" valign="middle" bgcolor="#5B9ADD" scope="col"><h1 class="style2"> 华 电 测 试 数 据 下 载 中 心</h1></th>
      </tr>
    </table>文件名include下面的footer.php<table width=778 border=1 align=center cellpadding=0 bordercolor=black cellspacing=0 style='border-collapse:collapse;'>
      <tr>
        <td height="50" align=center valign="middle" bgcolor="efefef"><? echo $copyright;?><br>
        Powered by huadian Version <? echo $version;?> </td>
      </tr>
    </table>
    <br>
    </body>
    </html>
      

  15.   

    文件名是include下的config_inc.php ,要你要修改的地方 数据库名称和数据库表名
    <?php// ------------------------------ -------- ------------------------------ //
    //  huadian Version 1.0.1        ( 华电下载系统 )                          //
    // ------------------------------ -------- ------------------------------ //
    //  Copyright (C) 2001  Kong Ling Ju                    //
    // ------------------------------ -------- ------------------------------ //
    // //            Powered by: huadian                  //
    // ------------------------------ -------- ------------------------------ //// ------------------------- -------- ------------------------- //
    // 以下为常规设置, 请仔细配置, 错误设置将出错.                  //
    // ------------------------- -------- ------------------------- //// ------------------------- -------- ------------------------- //
    //                           常规设置                           //
    // ------------------------- -------- ------------------------- //
    // 数据库信息
    $dbhost = "localhost";  // 数据库主机名
    $dbuser = "root";  // 数据库用户名
    $dbpasswd = "root";  // 数据库密码
    $dbname = "huadian";  // 数据库名
    // 网站设置
    $site_name = "华电内部";  // 网站名称
    $site_url = "http://127.0.0.1";  // 网站URL地址(最后不要以 "/" 结尾)
    $ymdown_url = "http://127.0.0.1/huadian";  // 程序URL地址(最后不要以 "/" 结尾)
    // 首页显示
    $shownum = 10;  // 首页显示记录数
    $namelen = 30;  // 首页名称限制字符数
    // 列表显示
    $list_num = 7;  // 列表每页显示记录数
    $list_page_num = 8; // 列表显示页数
    $list_brief_num = 50; // 列表简介限制字符数
    // Cookie 名称
    $cookie_name = "qiekong";
    // 版权信息
    $copyright = "Copyright (C) 1999-2001 YeMao.net All Rights Reserved.";// ------------------------- -------- ------------------------- //
    // 警告: 以下为固定设置, 不了解请不要修改, 否则可能出错!        //
    // ------------------------- -------- ------------------------- //// ------------------------- -------- ------------------------- //
    //                           固定设置                           //
    // ------------------------- -------- ------------------------- //// 版本号
    $version = "1.0.1";// 数据表名
    $down_table = hua;// 日期格式 ( Y.m.d H:i:s 分别为 年.月.日 时:分:秒 )
    $datetxt = "Y.m.d";// ------------------------- 结束设置 ------------------------- //
    ?>
      

  16.   

    你没有把哪个去掉了,那一页就一个错误现在我3个了
    我的php不支持mysql
      

  17.   

    http://www.uplinux.com/www/dev/01/0101/20040814/01011-9-92.shtml
      

  18.   

    PHP.INI里
    把“;extension=php_mysql.dll”前面的分号去掉
    关于LINUX服务器配置多看看这里:
    http://www.linuxsir.com
      

  19.   

    PHP.INI里
    把“;extension=mysql.so”前面的分号去掉;如果没有加上他;
    如果没有mysql.so,请locate mysql,你会发现类似mysql.client.so....的文件,你要进入你的php module的目录,如不知道,你可以看一下,/etc/php.ini中的已经加载一些模块(即带.so的文件)locate一下这些模块,看看module的目录在哪里,找到后,在目录下建个mysql.so文件.后,再ln -s 你的目录/mysqlclient.so......  mysql.so即可,如果没有mysqlclient文件请安装mysql.dev....rpm的开发库....
    安我的步骤做后肯定没问题的,您试试
      

  20.   

    index.ph的15行。我把config.php该了/不行
    饿
      

  21.   

    你改一下include下的config_inc.php文件中的
    $down_table = hua; 其中的hua改为你的表名。
    $dbname = "huadian"; 其中的huadian改为你的数据库名成。就可以了
      

  22.   

    allsql = "SELECT * FROM $down_table";
      

  23.   

    你在config_inc.php中找到$down_table这名字了没有,找到了作下列修改
    $down_table="你的数据库表的名称"就可以了
      

  24.   

    你在config_inc.php中找到
    $dbuser = "root";  // 数据库用户名
    $dbpasswd = "root";  // 数据库密码
    $dbname = "huadian";  // 数据库名
    要更改
    $dbuser = "你数据库的用户名称"; 
    $dbpasswd = "你数据库的用户密码"; 
    $dbname = "你数据库名称";