zoukankan      html  css  js  c++  java
  • 【转】一个英文版本的安装apache + PHP (From apache lounge)

    One of the biggest topics here at Apache Lounge is running PHP on Apache. It is a topic that is constant and for some reason often confused. Confused namely by varying ways to accomplish the same thing. The following has been tested numerous times, and seems (at least so far) to be easy to follow.

    IF YOU PREVIOUSLY INSTALLED APACHE USING A MSI FILE THEN (otherwise skip down to CONTINUE section):
    I have not tested Apache Software Foundation (ASF) MSI installation applications lately, but the last time I tested the MSI FAILED to remove to some things that can cause problems later on during the Un-Install process. BEFORE you UN-INSTALL the MSI file, open a command prompt and navigate to the BIN folder of Apache. Now, uninstall the service:

    httpd -k uninstall

    Now that the service is removed, uninstall Apache and then ALL PHP entries (files [php5ts.dll and others depending on what each person has done in the past] that you copied from where ever to where ever - usually into the Windows\System32 folder).

    CONTINUE:

    Install the Microsoft VC++ Redistributable
    The reason for this is because it is NOT included in the latest versions of Windows; and Steffen's builds are compiled using Microsoft Visual C++ 2005. The Redistributable can be downloaded at the link below:

    http://www.microsoft.com/downloads/details.aspx?familyid=32BC1BEE-A3F9-4C13-9C99-220B62A191EE&displaylang=en

    Apache Setup
    Download httpd-2.2.3-win32-x86-ssl.zip from http://www.apachelounge.com/download/

    Note: you can substitue drive letters to what will work best for you or your situation. I advise however, that you DO NOT place PHP in the Apache root though.

    Unzip this ZIP file in a new folder called something like C:\Apache2. Then, read the file named Read Me First !!.txt. It will tell you how to setup the service for Apache. If you want or need ApacheMonitor you can create shortcuts however you like. Before installing ANYTHING else, ensure Apache will start. Open a command prompt and navigate to the BIN folder of Apache:
      1. At the prompt enter httpd
      2. If there's anything seriuosly wrong Apache will not start - the cursor will drop down one line and blink (you should be able to use your browser and navigate to http://localhost and see "It Work!".
      3. With focus on the Command Prompt window - Hold down CTRL hit the C key then release both - within a couple of seconds the prompt will be released (Apach will Stop).
    After you validate that Apache starts, stop it before proceding.

    PHP Setup

    Note: you can substitue drive letters and folder names to what will work best for you or your situation. I advise however, that you DO NOT place PHP in the Apache root though.

    If you are still with me, now download PHP 5.x from PHP.net you want this file: php-5.x.xx-Win32.zip (where x relates to the latest stable version number)

    Extract the contents of this file and move the contents to where you intend to use PHP such as C:\PHP5.

    NEXT, download the PHP handler: php5apache2.dll-php5.1.x.zip from http://www.apachelounge.com/download/

    THEN, extract files and overwrite the php5apache2.dll in the PHP folder with Steffen's version - READ the 'ReadMe' file for possible changes.

    Navigate to the PHP folder and edit the php.ini-recommended. FIND the extension_dir directive and change so that it properly locates the EXT folder:

    extension_dir = "C:\php5\ext"

    Save the file as php.ini.

    THIS MUST BE ACCOMPLISHED (see note below): Add the folder that you put the PHP files into in the PATH ENVIRONMENT (System Properties | Advanced | Environment Variables | System variables | Path).

    Example:
      Variable name: Path
      Variable value: C:\php5;%SystemRoot%\system32;.....

    Note: DO NOT WORRY with coping files over to the Windows folders, the reason for this to begin with is because Windows folder is already in the Path. Since you have added the PHP folder to the Path you do not need to copy or move files to the Windows folder. This will make upgrading PHP simpler as well and allows you to keep PHP all together. To upgrade PHP in the future, all you need to do is overwrite the contents of the PHP folder with the new files/folders extracted from the contents of the new PHP versioned zip.

    Finally, this should be the last step, edit the Apache CONF file (httpd.conf) with:
      LoadModule php5_module "c:/php5/php5apache2.dll"
      AddType application/x-httpd-php .php
      AddType application/x-httpd-php .php-source .phps
      # configure the path to php.ini
      PHPIniDir "c:/php5"

    Save the httpd.conf file, Start Apache.
    END PHP Setup

    If you receive no errors, and you want to run Apache as a Service then open a command prompt and navigate to the BIN folder of Apache. Now, install the service:
      httpd -k install

    That command will add Apache2 to the Services MSC.

    If do not want Apache starting automatically at start-up/reboot:

      1. START | RUN
      2. Type in services.msc, hit Enter or click OK
      3. Locate Apache2 service and double-click (or right-click for Properties)
      4. Find the caption Startup type: (in the middle of the dialog box), use the pull-down and select Manual
      5. Click OK

    This is how I put together the WAP in WAMP, and I do it often (web application tester). I'll be adding the MySQL setup soon.

  • 相关阅读:
    atitit,it人怎么样才容易事业成功?? 有以下五种性格的人容易成功
    atitit。win7 win8 win9 win10 win11 新特性总结与战略规划
    atitit.提升兼容性最佳实践 o9o
    atitit.attilax.com产品 软件项目通用框架类库总结
    atitit. 文件上传带进度条 atiUP 设计 java c# php
    atitit.窗体静听esc退出本窗体java swing c# .net php
    atitit.提升研发管理的利器---重型框架 框架 类库的区别
    atitit.导出excel的设计----查询结果 导出为excel的实现java .net php 总结
    atitit. java跟php的比较..为什么大企业喜欢java 而不是php
    atitit. java jsoup html table的读取解析 总结
  • 原文地址:https://www.cnblogs.com/cpu/p/648836.html
Copyright © 2011-2022 走看看