• 第一课 安装wamp环境


    1.准备

    怎样选择PHP的版本

    IIS

    如果想使用IIS配置PHP的话,那么需要选择Non-Thread Safe(NTS)版本的PHP

    Apache

    如果你是用的Apache的版本来自Apache Lounge(website:http://apachelounge.com/),可以使用PHP VC11 x86或者x64版本。

    如果你使用的是从apache.org下载的Apache1或者Apache2来搭建PHP环境的话,只能使用VC6版本,无法使用VC9+以上版本。

    VC9 和VC11

    VC9和VC11是PHP的最新版本(这两个版本分别通过Visual Studio 2008和Visual Studio 2012编译),其中包含了对于性能和稳定性的改进。

    VC9版本要求用户安装Microsoft Visual C++ 2008 SP1 Redistributable Package(x86 | x64

    VC11版本要求用户安装Visual C++ Redistributable for Visual Studio 2012(x86 | x64

    第一、安装并配置APACHE(安装到D:phpapacheApache2.2)
          1、安装时默认安装,Network Domain, Server Name 我填写我的计算机名,Administrator's Email Address区域填你的邮件地址
          2、安装完后在安装目录下有个conf文件夹,打开httpd.conf文件进行配置
             ·找到 DocumentRoot ,将其设置为你所要存放php, htm等网页文件的文件夹,如 "DocumentRoot "I:/myweb/www"";

                  

    <Directory "I:/myweb/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.2/mod/core.html#options
        # 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 None

        #
        # Controls who can get stuff from this server.
        #
        Order allow,deny
        Allow from all

    </Directory>


             ·找到 DirectoryIndex ,在index.html后添加index.php, index.htm等,以逗号将其分开;

                <IfModule dir_module>
                      DirectoryIndex  index.php,index.html
                </IfModule>

               ·重启Apache,用http://localhosthttp://127.0.0.1http://yourcompanyname测试是否成功。成功的话屏幕会有个It works

     

     第三、安装配置PHP(解压PHP压缩包到i:/php/)
            1、将php.ini-recommended文件重命名为php.ini并将其剪到系统所在目录下(如放在2000/NT的WINNT, XP的Windows目录下),
            2、将extension_dir 改为php/ext所在目录,如 "i:phpext";
            3、将doc_root 改为第一步中的同样目录,如 "i:mywebwww";
            4、找到 ;session.save_path = "/tmp" ,将';'去掉,设置你保存session的目录,如session.save_path = "i:/php/session_temp";
            5、然后把下面几句前面的分号去掉,以更好支持Mysql and PHPmyadmin
                extension=php_mbstring.dll
                extension=php_gd2.dll
                extension=php_mysql.dll

      

        第四、PHP+APACHE
           1、允许Apache将PHP程序作为模块来运行:
               打开httpd.conf,添加下面内容(位置任意):
                 LoadModule php5_module "d:/phpapache/php/php5apache2.2.dll"(根据版本选择)

        PhpIniDir "I:/myweb/php"

          设置

    onfiguration File (php.ini) Path C:Windows
    Loaded Configuration File I:mywebphpphp.ini

                 AddType application/x-httpd-php .php


                 AddType application/x-httpd-php .htm
                (.htm, .php为可执行php语言的扩展名,也可加html, php3, php4,甚至txt)
               (以下两步可以不需要) 

    第五、重起服务
          1、在d:PHP里找到php5ts.dll,libmysql.dll将其复制到c:winntsystem32下(winNT/2000的机器),而winXP/2003是复制到c:windowssystem32下(不需要)      2、测试Apache与php是否连接成功:
              启动start apache服务或者正在运行的就重新启动restart apache
          3、在Web根目录下新建test.php(即E:Program FilesApache Software FoundationApache2.2htdocs目下)
               <html>
               <head><title>test</title></head>
               <body>
                <?php
                  phpinfo();
                ?>
             </body>
              </html>

          4、运行http://localhost/test.php

    注释:

    如果之前安装了apache服务,则要卸载掉,cmd=》sc  delete  Apache2.2(这个服务可以从services看到),当然也有其他方法,不过推荐这个

  • 相关阅读:
    怎么控制 echarts提示框浮层的内容
    控制echarts 柱状图啊的柱条的宽度
    如何控制echartsY轴颠倒
    mac mysql nginx
    input textarea 获取焦点挡住输入法 解决办法
    react 记录
    微信内自动播放audio
    react router
    mysql 记录
    express 插件
  • 原文地址:https://www.cnblogs.com/legend-song/p/3642194.html
Copyright © 2020-2023  润新知