日期:2014-05-17 浏览次数:20577 次
参考:http://blog.csdn.net/wujunokay/article/details/12707259
这个最好到官方网站下载,有zip,也有安装的,我下载的是zip的,解压后,就可以直接用了。
关于版本有的里面没有php5apache2_2.dll,原因是版本不对,如何来判断版本呢?
v6c又有两个版本如下:
vc6 x86 non thread safe
vc6 x86 thread safe
以上两个版本中,non thread safe版的php在安装过程中,
没有apache的选项:
select the web server you wish to setup
iis fastcgi
other cgi
do not setup a web server
而thread safe版的安装过程中有apache 2.2.x module选项:
select the web server you wish to setup
apache 2.2.x module
apache cgi
iis fastcgi
iis cgi
nsapi
xitami
netserve web server
other cgi
do not setup a web server
如果要用php5apache2_2.dll,就要下载 x86 thread safe 系列的,我下载的是php-5.4.20-Win32-VC9-x86。
1.将你php安装目录下的文件php.ini-development改名字为php.ini。
2.配置upload_tmp_dir =路径,比如upload_tmp_dir="D:\myphpTmp"。
3.在阿帕奇的httpd文件里增加:
LoadModule php5_module "d:/my program/php-5.4.20-Win32-VC9-x86/php5apache2_2.dll"
PHPIniDir "d:/my program/php-5.4.20-Win32-VC9-x86"
AddType application/x-httpd-php .php .html .htm
4.在php.ini里:extension_dir改成自己安装的路径里的ext,比如:extension_dir = "D:\my program\php-5.4.20-Win32-VC9-x86\ext"。
1.upload.html里代码如下:
<html> <body> <form action="upload_file_web.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>
2.upload_file_web.php代码如下:
<?php //$file = $_GET['filename']; //file_put_contents("aaa.txt", var_export($file,true)); file_put_contents("abb.txt", var_export($_FILES,true)); upload_file(); function upload_file() { $error; if ($_FILES["trackdata"]["error"] > 0) { //echo "Error: " . $_FILES["trackdata"]["error"] . "<br />"; $error = "200"; } else { //echo "Upload: " . $_FILES["trackdata"]["name"] . "<br />"; //echo "Type: " . $_FILES["trackdata"]["type"] . "<br />"; //echo "Size: " . ($_FILES["trackdata"]["size"] / 1024) . " Kb<br />"; //echo "Stored in: " . $_FILES["trackdata"]["tmp_name"]. "<br />" ; } if (file_exists("upload/" . $_FILES["trackdata"]["name"])) { //echo $_FILES["trackdata"]["name"] . " already exists. "; $error = "201"; } else { move_uploaded_file($_FILES["trackdata"]["tmp_name"],"upload/" . $_FILES["trackdata"]["name"]); //echo "Stored in: " . "upload/" . $_FILES["trackdata"]["name"]; $error = 202; } echo $error