php服务器配置计算,Windows下Apache+Mysql+PHP服务器配置的一些经验

本人使用的是Apache1.3.28+PHP4.3.2+Mysql4.23.55+phpMyAdmin2.5.0黄金组合,因此以下就说一下学习php以来积累的一些服务器配置方面的应验:(本文以Apache+PHP+Mysql都安装在D盘为例)

一.Apache

安装好你的Apache服务器以后,Apache已能正常工作,但是还不能处理PHP程序,需进一步配置Apache使能处理PHP程序。在Apache安装目录里找到文件httpd.conf,本实验中文件的全路径为d:\Apache\conf\httpd.conf,并用记事本打开httpd.conf,加上如下几句:

[code]

scriptalias /php4/ "D:/php/"

addtype application/x-httpd-php .php .php3

action application/x-httpd-php /php4/php.exe

[/code]

注意各语句中的空格不能少,输入完之后保存文件。

要使上步中的配置生效,需要重新启动Apache,重启有多种方法,最简便的方法就是从开始菜单,如图13,也可以从运行栏里先运行命令net stop apache停止apache,再运行命令net start apache启动apache。如果启动不了,说明上步配置中有错误。

另外,介绍一个本机Apache服务器认证机制

1.首先在你的需要认证 机制的目录下边放一个名称为 .htaccess的文件,一般只有后缀的文件是不能建立的,您可以用一个非常优秀的程序编辑器Edit plus建立,假如你的apache安装在D:盘里,并且你的apache服务器 路径为:

D:\Apache\htdocs,那么这个.htaccess的文件里的 内容就为 :

[code]

AuthUserFile "D:\Apache\bin\pass.txt"

AuthName AnyName

AuthType basic

Require valid-user

[/code]

2.然后,把它放到 任何一个D:\Apache\htdocs的一个 目录下边 ,然后在“开始”——“运行”里打入“cmd”, 然后在

C:\>d:

D:\>cd Apache

D:\Apache>cd bin

D:\Apache\bin>htpasswd.exe

会出现 下列信息:

Usage: htpasswd [-cmdps] passwordfile username

htpasswd -b[cmdps] passwordfile username password

htpasswd -n[mdps] username

htpasswd -nb[mdps] username password

-c Create a new file.

-n Don't update file; display results on stdout.

-m Force MD5 encryption of the password (default).

-d Force CRYPT encryption of the password.

-p Do not encrypt the password (plaintext).

-s Force SHA encryption of the password.

-b Use the password from the command line rather than prompting for it. On Windows, TPF and NetWare systems the '-m' flag is used by default. On all other systems, the '-p' flag will probably not work.

3.然后是 :

D:\Apache\bin>htpasswd -m pass.txt chai

New password: ******

Re-type new password: ******

Adding password for user chai

4.然后在D:\Apache\conf目 录下边找到httpd.conf这个文 件在这个文件里找到这样一个关键字“ AllowOverride”看后边的一个 单词是不是All,如果 是不是,就更改为All,然后重新启 动Apache服务器就可以了。然后你就可以在 你的浏览器 里打入你的服务器目录了 ,这样你的认证机制就实现了。

如果是想在自己 在 http上服务器的 数据库空间上,如果有一个数据库管理工具phpMyAdmin,则可以通过修改 phpMyAdmin下边的config.inc.php文件实现,具体的方法是:

在这个文件里找 到

$cfg['Servers'][$i]['auth_type'] = 'config'; // Authentication method (config, http or cookie based)?

然后把它修改为 :

$cfg['Servers'][$i]['auth_type'] = 'http'; // Authentication method (config, http or cookie based)?

这样你的数据库 就可以实现身份验证了。

二.PHP

一般情况下,php很好配置,就是在你的D:\php\php.ini文件有些需要注意的地方:

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值