Emmmmm....有关php的集成环境搭建,比如wampserver和phpstudy,主要是集成了php环境,mysql,apache服务器,这三大块而组成的,其中在搭建环境的时候遇到了很多问题,最主要的问题是对域php的解析不是很懂,所以被卡了很久,接下来又很重要的几点总结:
1.浏览器不能解析php,必须在浏览器上输入域名去访问,否则在浏览器上将只会显示代码
2.更改网站根目录,需要在httpd.conf、http-vhost.conf、以及config.inc.php上改代码,其中在config.inc.php文件中找到$wwwDir字符,将后面的路径改成需要的路径,其次在http.conf文件中找到documentroot和directory字符将后面的路径改成需要的字符,在http-vhost.conf中也改成路径
还可以进行多站点设置,这时需要在http_vhost.conf中添加一个虚拟主机,代码如下:
<code>
<VirtualHost *:80>
    ServerName localhost
    ServerAlias localhost
    DocumentRoot c:/wamp/www
    <Directory  "c:/wamp/www/">
        Options +Indexes +Includes +FollowSymLinks +MultiViews
        AllowOverride All
        Require local
    </Directory>
</VirtualHost>
<VirtualHost *:80>
    ServerName website
    DocumentRoot F:/html/myself
    <Directory  "F:/html/myself">
        Options +Indexes +Includes +FollowSymLinks +MultiViews
        AllowOverride All
        Require local
    </Directory>
</VirtualHost>
</code>
然后在http.conf上给http-vhost.conf的虚拟主机配置好设置,其实只要把原来就有的代码复制一下然后再改一改路径就可以了,代码如下:
<code>
<Directory "${INSTALL_DIR}/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
    # http://httpd.apache.org/docs/2.4/mod/core.html#options
    # for more information.
    #
    Options +Indexes +FollowSymLinks +Multiviews

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

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

#   onlineoffline tag - don't remove
    Require local
</Directory>
DocumentRoot F:/html/myself
    <Directory  "F:/html/myself">
        Options +Indexes +Includes +FollowSymLinks +MultiViews
        AllowOverride All
        Require local
</Directory>
</code>
最后再给电脑添加该站点,找到C:\Windows\System32\drivers\etc\hosts文件,然后加上自己的路径和虚拟主机名就可以了。
<code>
# localhost name resolution is handled within DNS itself.
    127.0.0.1       localhost
#    ::1             localhost
    127.0.0.1       website
</code>
这样就完成了php的多站点设置。
然后我们可以自拟定端口号,只要在http.conf里面找到如下代码:
<code>
#Listen 12.34.56.78:80
Listen 0.0.0.0:80
Listen [::0]:80
</code>
和这段代码:
<code>ServerName localhost:80</code>
然后将端口号改成自己想要的端口号就可以了。