WampServer安装好之后的初始配置

WampServer安装好之后, 进行一些初始配置以方便日后的开发使用。

修改默认时区

打开php.ini,找到[Date]部分,将timezone修改成如下所示:

; Defines the default timezone used by the date functions

; http://php.net/date.timezone

date.timezone = "Asia/Shanghai"

修改MySQl的默认字符集

WampServer安装后,MySQL的缺省字符集有好几种,latin1、gbk、utf8都有,用show variables可以看到,为了减少后续麻烦,必须统一。综合考虑准备统一为utf8

1)测试验证,进入mysql控制台,
    SHOW VARIABLES LIKE 'character_set_%';  //保存数用据
    SHOW VARIABLES LIKE 'collation_%';      //排序用

2)修改my.ini
[wampmysqld]  新增两行:
    character-set-server = utf8
    collation-server = utf8_general_ci
[mysql]  新增一行
    default-character-set = utf8

3)更改已有库的字符集
    alter database mysql character set utf8;

 

 

防止部署完项目后,客户端访问服务器403错误

问题描述:

将网站在服务器部署好之后,能够在服务器上使用IP地址或者localhost方式正常访问,但同一网段的其它电脑访问该站点的时候,却遭遇403错误。

IE或者chrome的提示大致意思是:你可以连接到该站点,但却没有权限访问。

解决方法:
仔细查看httpd:conf文件,其中有以下一条目:
 <Directory "C:/Program Files/wamp/www/">
    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.
    #
    # The Options directive is both complicated and important.  Please see
    # for more information.
    #
    Options Indexes FollowSymLinks

    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   Options FileInfo AuthConfig Limit
    #
    AllowOverride all

    #
    # Controls who can get stuff from this server.
    #

#   onlineoffline tag - don't remove
    Order Deny,Allow
    Deny from all
    Allow from 127.0.0.1

</Directory> 

注意最后:“Controls who can get stuff from this server”, “Deny from all”, “Allow from all” 这三段给出了解决方法的提示。

所以解决方法是:将“Deny from all”修改为"Allow from all",重启Apache服务即可。

猜你喜欢

转载自heirenhua.iteye.com/blog/1566642
今日推荐