设为首页  加入收藏  联系我们 繁體中文  

黑客软件:

  漏洞扫描 | 木马间谍 | 加密解密 | 远程控制 | 破坏攻击 | 杀毒软件 | 防火墙类 | OICQ专区 | 黑客必备 | 常用工具 | 网吧攻击
文章中心:   最新资讯 | 黑客技术 | 电脑基础 | 菜鸟文摘 | 网络安全 | 网络技巧 | QQ技巧 | OQ空间代码 | 免费资源 | 编程世界 | 建站技术
素材源码:   论坛相关 | ASP源码 | CGI 源码 | NET 源码 | PHP 源码 | 酷站素材 | 字体素材 | 图片素材 | 友情发布 | 网页模版 | 建站软件
教程动画:   黑客教程 | 黑客编程 | 网站入侵 | 菜鸟教程 | 入侵教程 | 破解教程 | 电子书籍 | 网页制作 | 高级会员 | 综合教程 | 本站原创


   

  您当前的位置:中华隐士黑客联盟 -> 建站技术 -> WEB服务器 -> 文章内容 [站内搜索]  

 
Apache2+PHP4+MySql配置
作者:佚名  来源:不详  发布时间:2006-11-11 23:50:34  发布人:www.hack86.com
1、安装html" class="wordstyle">php:将下载的html" class="wordstyle">php压缩文件解压,文件夹改名为html" class="wordstyle">php复制到c盘根目录下。


2、打开刚才解压的html" class="wordstyle">PHP目录,你会发现有一个叫做"html" class="wordstyle">php.ini-dist"的文件,这就是html" class="wordstyle">PHP的配置文件了,你需要把它改名成"html" class="wordstyle">php.ini",然后复制到系统目录winnt下。

修改html" class="wordstyle">php.ini其中有必要注意的是
270行error_reporting = E_ALL & ~E_NOTICE
277行display_errors = On
另:365行register_globals 默认 Off,改成on的意思是打开全局变量,以后编程方便。
; cgi.force_redirect = 1改成 cgi.force_redirect = 0这样做是强迫不运行在cgi模式下

3、 html" class="wordstyle">PHP安装目录下的"html" class="wordstyle">php4ts.dll"必须要复制到windows系统的system32目录下

4、dlls和extensions目录里的所有文件拷到system32 里




Apache2安装
首先停止你的iis或pws服务。
1 运行你下载的Apache2安装文件,安装Apache,安装过程中会提示你输入主机名,管理员信箱等信箱,这些信息在你安装完以后是可以修改的,所以可以放心的输入。
(*为了以后操作方便起见,强烈建议将此处的安装路径用"Change"改变到"X:"下(注X为你的硬盘盘符)或者符合8.3文件名格式的其他名称,以后每次输入Apache安装路径时,都不必为其添加引号。系统安装成功后将自动在此建立一个名为"Apache2"的目录,也就是说,安装之后的实际Apache系统文件所在路径将为"X:Apache2"目录。*)

安装完后,在apache2confhttpd.conf 下查找ServerAdmin,即可修改管理员信箱,(199行附近);213行则是ServerName 我改为localhost
以后我都是把程序放在了apache2的htdocs下的子目录zimulu,用html" class="wordstyle">php>http://localhost:81/zimulu/xxx.html" class="wordstyle">php 测试。

2 编辑apache2/conf/httpd.conf

120行Listen 80改为81端口,这是因为当你的win2k重起后,iis将会重占80端口,为避免冲突,所以apache使用81端口。
下面的134-170行左右为加载模块的部分。在这部分下面的加上两句:
LoadModule html" class="wordstyle">php4_module c:/html" class="wordstyle">php/sapi/html" class="wordstyle">php4apache2.dll
//注释:如果你的html" class="wordstyle">php目录不是C:/html" class="wordstyle">php,请按实际来写。
AddType application/x-httpd-html" class="wordstyle">php .html" class="wordstyle">php .html" class="wordstyle">php3 .html" class="wordstyle">php4
(这一句有人说也可以加到768行左右的AddType application/x-tar .tgz之后,不过我有一次这么作了以后没弄成)意思是:加载html" class="wordstyle">php4模块, 其中第2句如果仅仅是AddType application/x-httpd-html" class="wordstyle">php .html" class="wordstyle">php则只能解析html" class="wordstyle">php扩展名的文件,html" class="wordstyle">php3扩展名的程序解析不了。

注意:我们一般是模块化运行html" class="wordstyle">php,所以仅仅这样即可,有的文章说如此添加:
scriptAlias /html" class="wordstyle">php/ "c:/html" class="wordstyle">php/"
AddType application/x-httpd-html" class="wordstyle">php .html" class="wordstyle">php
Action application/x-httpd-html" class="wordstyle">php "/html" class="wordstyle">php/html" class="wordstyle">php.exe"
或者
LoadModule html" class="wordstyle">php4_module c:/html" class="wordstyle">php/sapi/html" class="wordstyle">php4apache2.dll
AddType application/x-httpd-html" class="wordstyle">php .html" class="wordstyle">php4
scriptAlias /html" class="wordstyle">php4/ "c:/html" class="wordstyle">php/"
Action application/x-httpd-html" class="wordstyle">php4 "/html" class="wordstyle">php4/html" class="wordstyle">php.exe"
AddType application/x-httpd-html" class="wordstyle">php4 .html" class="wordstyle">php
其实是以cgi方式运行html" class="wordstyle">php,没有那个必要。


找到DirectoryIndex * 这行,可以这样修改,添加默认的文件名:
DirectoryIndex index.html" class="wordstyle">php default.html" class="wordstyle">php index.htm index.html default.htm default.html
否则不能自动识别index.html" class="wordstyle">php。


使之支持中文

最好的解决办法是:修改了Apache中conf/httpd.conf文件,查找 AddDefaultCharset ISO-8859-1
并且改成
#AddDefaultCharset ISO-8859-1
AddDefaultCharset GB2312
注意使用dreamweaver做出的文件多有:

<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
其实这样往往导致文件中中文成乱码!!因为:http.conf中355行 DefaultType text/plain而不是text/html,所以手动修改成text/plain即显示中文。

3 开始---运行----cmd
c:Apache2/bin>
输入apache -k install
输入apache -k start
4 访问http://localhost:81显示APACHE欢迎页 (恭喜,Apache2安装成功)
写一最简单的html" class="wordstyle">php程序
<?html" class="wordstyle">php
html" class="wordstyle">phpinfo();
?>
,命名为info.html" class="wordstyle">php存入apache2/htdocs下,然后地址栏内敲入html" class="wordstyle">php>http://localhost:81/info.html" class="wordstyle">php应该显示html" class="wordstyle">php和apache2的相关信息了,这样终于就可以开始html" class="wordstyle">php学习之旅(乐)。
(什么您不愿意把程序放在apache2/htdocs下,那么回到httpd.conf找DocumentRoot "x:/Apache/htdocs"把x:/Apache/htdocs改成你喜欢的目录名就是了。)

仅仅是html" class="wordstyle">php 还是不够的,很多大一点的程序都用得到数据库,于是我们开始了:

mysql的安装

象大多资料所讲述的那样,Mysql轻而易举的就安装成功的,安装简单,但是调试难。mysql安装成功后,进入mysql/bin双击winmysqladmin,第一次运行需要输入用户名密码,比如我的虚拟空间的数据库用户名abc,密码是xyz;于是我就输入了abc xyz;为了是以后本地作好的程序可以直接ftp 。然而~~~~黄粱美梦~~~~~名副其实的黄粱美梦,不到5分钟(煮熟米饭好象要10分钟吧)我就蒙了:我有一个程序
<?html" class="wordstyle">php

$db_conn=mysql_connect("localhost","abc","xyz") or die("Can''t connect!!");

?>



在虚拟空间运行的好好的,到本地就是连接不上数据库!!把html" class="wordstyle">phpmyadmin2.5.4改个名成p254,进里面把config.inc打开,修改第80、81行
$cfg[''Servers''][$i][''user''] = ''abc'';
$cfg[''Servers''][$i][''password''] = ''xyz'';
第83行的$cfg[''Servers''][$i][''only_db''] = '''';如果键入数据库名dbone,则html" class="wordstyle">phpmyadmin内只能看到这一个dbone数据库了,其余的都看不到。
地址栏里键入http://localhost:81/p254(最好关了防火墙,即使你用的是公安部评分95分的那个)然而出现在我眼帘的是:
html" class="wordstyle">phpMyAdmin 试图连接到 MySQL 服务器,但服务器拒绝连接。您应该检查 config.inc.html" class="wordstyle">php 中的主机、用户名和密码,并且确定这些信息与MySQL 服务器的管理员所给出的信息一致。

而我把confgi.inc的内容改回去也就是用
$cfg[''Servers''][$i][''user''] = ''root'';
$cfg[''Servers''][$i][''password''] = '''';
则可以连接成功!!

面对这种情况,我参考上次安装mysql3.23.55的经验,进了winnt里找my.ini,修改最下面2行
user=abc
password=xyz

还是不行,于是开始胡思乱想,好一通修改:html" class="wordstyle">php.ini里有关于mysql的项目,改,不好用;config.inc下面还有$i = 1时的
$cfg[''Servers''][$i][''user'']
$cfg[''Servers''][$i][''password'']
也改了,(其实那是用于多个mysql运行的时候管理用的,单机上只跑一个mysql根本就用不着改)。晕~~~~上了一通csdn,被告之删了my.ini,重起后自动重新生成my.ini,比样照作~~~~双击winmysqladmin,果然又是让输入username和password。然而重新输入的,还是不起作用!!于是脑袋一热耍起小聪明 来,重新改写config.inc用root和空密码进入html" class="wordstyle">phpmyadmin,进mysql数据库的user表,直接插如一个uk15f1的用户名密码就是o1s3f2g7,结果~~~~竟然决然居然还是不好用!!!(注意:这个毛病在用mysql 3.x时没有犯过,可能是mysql4.x的bug)最后的解决是使用命令行c:mysql/bin/mysql -h localhost -u root -p回车,提示输入密码,敲回车表示空密码,在mysql提示符下set password for abc@"localhost"=password(''xyz'');

重启系统,OK.

常见的问题


A: 为何新版html" class="wordstyle">PHP提示Notice的警告?

例如 Notice: Use of undefined constant HTTP_HOST - assumed ''HTTP_HOST'' in d:inetpubwwwroot22schoolsyinfo.html" class="wordstyle">php on line 19

Q:

产生问题的原因是使用了没有定义或者初始化的变量和数组,例如你用$_POST[test],但是你没有提交过name=test的表单,就会碰到Notice的错误,因为$_POST没有键值为test对应的值,也就是说程序调用了一个没有定义的数组索引。一般来说,是在程序不够严谨的时候才会出现这样类型的问题,但是不影响程序的运行。可以在程序中加入程序 error_reporting(0); 关闭该提示,或者设置html" class="wordstyle">php.ini中error display 一节;也可以预先初始化出错的变量。


Q: Apache启动时,为何不能加载html" class="wordstyle">php4apache.dll?

Windows系统刚安装完成Apache+html" class="wordstyle">PHP的系统,整合html" class="wordstyle">PHP后,在启动Apache的时候提示:系统提示加载不了html" class="wordstyle">php4apache.dll(或者html" class="wordstyle">php4apache2.dll),例如can''t load of c:myhtml" class="wordstyle">phphtml" class="wordstyle">phpsaiphtml" class="wordstyle">php4apache.dll

A: 这是Apache没有找到html" class="wordstyle">php4ts.dll文件的缘故
html" class="wordstyle">php4ts.dll文件拷贝到系统目录下(例如c:winntsystem32)或者Apache下面的bin目录中,然后重新启动Apache,即可解决

后记:
html" class="wordstyle">PHP 4.1.0 的 html" class="wordstyle">php.ini 的全文翻译
http://www.21html" class="wordstyle">php.com/forums/showthread.html" class="wordstyle">php?s=&;threadid=1717


高级配置
magic_quotes_gpc = Off [Performance] 改成0

session.save_handler = files

Warning: session_start(): open(/tmpsess_7d190aa36b4c5ec13a5c1649cc2da23f, O_RDWR) failed:....

session路径没有配置

在apache所在分区根目录下建立一个tmp的文件夹,OK.
[] [返回上一页] [打 印] [收 藏]
  [相关文章评论]    (评论内容只代表网友观点,与本站立场无关!) [更多评论...]
 

  对kappa官方网站的渗..
学习采用Mod_SSL技术..
连载:经典好文 专家..
推荐:经典好文 专家..
推荐:经典好文 专家..
推荐:经典好文 专家..
连载:经典好文 专家..
推荐:经典好文 专家..
推荐:经典好文 专家..
用ISAPI FILTER保护..


 
免费获得Q币的最新方法
最新免费在线看的电影网站集绵
不用木马,轻松万能偷daoQQ号码
最新QQ空间4.0全屏版效果图!!
新免蟆Q秀,刷红钻的方法
黑客快速入门(强烈推荐)
18岁少女欲6000元卖处女身 救患血..
QQ密码本地破解的原理和方法
8款QQ空间免费开场动画
免费QQ蓝钻体验(附考试答案)
 
情感之折断翅膀 12-05
FD-我的音乐世界 12-05
FD-视觉牛B 12-05
非主流女女 鼠标触摸 12-05
QQ宠物熊于12月4日开始可以领取 12-05
12-05 今日最新代理IP HTTP代理服.. 12-05
当一切茫然我只知道爱你 12-05
逃出寂寞的缠绕 12-05
可爱小狗狗 偶滴窝窝 12-05
帅到掉渣的动态大图 12-05
 
关于本站 网站帮助 广告合作 下载声明 友情连接 网站地图 访客留言 论坛登录
〖中华隐士黑客联盟〗,Copyright © 2006-2010 WwW.Hack86.Com 闽ICP备:06023304号
站长:小质 QQ:771760,软件发布MAIL:Hack086@21cn.com