WAMP 简易配置

来源:互联网 发布:微信抓娃娃源码 编辑:程序博客网 时间:2024/06/04 23:21

基础环境:

  • MySQL5.5.27
  • Apache 2.2.21
  • PHP5.4 

Apache之httpd.conf配置

  • ServerName  --- 服务器名称, eg: ServerName www.crper.com:80
  • ServerAdmin  --- 服务器邮箱,  eg: xxx@xxx.xxx
  • Listen --- 默认是80端口且不带IP , eg: 192.168.10.1:80(只监听该IP的80端口),看需求改动,若80端口被其他端口占用可以更改
  • ServerRoot --- Apache的安装目录,比如你在一台机子安装了,不想重新安装,把整个文件copy过去,根据路径作出修改; eg:ServerRoot "D:/WebDev/Apache Software Foundation/Apache2.2"
  • LoadModule php5_module "盘符:/PHP路径/xx.dll" --- 记住路径是反斜杠,这个模块需要自己手动添加,用来解析php的
  • DocumentRoot --- 默认web站点目录存放路径
  • Directory "DocumentRoot" --- 默认Directory可访问范围是DocumentRoot,可以根据实际站点的位置做出修改 , eg:<Directory "D:/WebDev/Apache Software Foundation/Apache2.2/htdocs">
  • IfModule dir_module --- 站点目录默认页面 , eg:DirectoryIndex index.html index.htm index.php
  • ErrorLog / ErrorDocument  --- 错误日志的存放(默认PHP内部相对路径) / 错误页的引导
  • AddType application/x-httpd-php .php     --- 添加解析文件格式
  • PHPIniDir "PHP路径" --- PHP配置文件加载路径 eg:PHPIniDir "D:/WebDev/php5.4"
我把主配置文件的其他杂项和注释给删除了,只保留了简易配置的步骤
ServerRoot "D:/WebDev/Apache Software Foundation/Apache2.2"Listen 80LoadModule php5_module "D:/WebDev/php5.4/php5apache2_2.dll"ServerAdmin 844095692@qq.com<Directory "D:/WebDev/Apache Software Foundation/Apache2.2/htdocs"></Directory><IfModule dir_module>    DirectoryIndex index.html index.htm index.php</IfModule>ErrorLog "logs/error.log"    AddType application/x-compress .Z    AddType application/x-gzip .gz .tgz    AddType application/x-httpd-php .php    AddType application/x-httpd-php .html    AddType application/x-httpd-php .htm    PHPIniDir "D:/WebDev/php5.4"ErrorDocument 500 "The server made a boo boo."ErrorDocument 404 /missing.htmlErrorDocument 404 "/cgi-bin/missing_handler.pl"ErrorDocument 402 http://www.crper.com/subscription_info.html

PHP之php.ini配置:

  • extension_dir  ---- php拓展模块的存放路径: eg : extension_dir = "D:/WebDev/php5.4/ext"
  • extension=xxx  ---- 这些开头的都是模块文件,把分号去掉就启用了,只是简易测试,把extension=php_mysql.dll前面的分号去掉即可
  • date.timezone --- 时区设置,可以为PRC((The People's Republic of China) ,Asia/Shanghai ==

MySQL5.5配置:

windows的MYSQL配置比较简易,在图形安装过程已经可以设置运行的基础环境,如最大连接数,数据库支持的类型,默认端口,根的密码....这里就不做多的解释了


测试代码:

<!DOCTYPE html ><head><title>Env</title><meta charset="utf-8"></head><body><?phpecho phpinfo();?><!--我是打印PHP环境信息的--><?php$con = mysql_connect("localhost","root","crperlin");if (!$con)  {  die('Could not connect: ' . mysql_error());  }else{echo "链接成功啦!!!!";}mysql_close($con);?><!--我是测试链接数据库的--></body></html>

测试结果:


原创粉丝点击