Annotation of embedaddon/php/win32/install.txt, revision 1.1.1.2

1.1       misho       1: Installing PHP
                      2:      __________________________________________________________________
                      3: 
                      4:    Table of Contents
                      5:    Preface
                      6:    1. General Installation Considerations
                      7:    2. Installation on Windows systems
                      8: 
                      9:         Windows Installer
                     10:         Manual Installation Steps
                     11:         ActiveScript
                     12:         Microsoft IIS / PWS
                     13:         Apache 1.3.x on Microsoft Windows
                     14:         Apache 2.0.x on Microsoft Windows
                     15:         Sun, iPlanet and Netscape servers on Microsoft Windows
                     16:         OmniHTTPd Server
                     17:         Sambar Server on Microsoft Windows
                     18:         Xitami on Microsoft Windows
                     19:         Installation of extensions on Windows
                     20: 
                     21:    3. Installation of PECL extensions
                     22: 
                     23:         Introduction to PECL Installations
                     24:         Downloading PECL extensions
                     25:         PECL for Windows users
                     26:         Compiling shared PECL extensions with the pecl command
                     27:         Compiling shared PECL extensions with phpize
                     28:         Compiling PECL extensions statically into PHP
                     29: 
                     30:    4. Problems?
                     31: 
                     32:         Read the FAQ
                     33:         Other problems
                     34:         Bug reports
                     35: 
                     36:    5. Runtime Configuration
                     37: 
                     38:         The configuration file
                     39:         How to change configuration settings
                     40: 
                     41:    6. Installation FAQ
                     42:      __________________________________________________________________
                     43: 
                     44: Preface
                     45: 
                     46:    These installation instructions were generated from the HTML version of
                     47:    the PHP Manual so formatting and linking have been altered. See the
                     48:    online and updated version at: http://php.net/install.windows
                     49:      __________________________________________________________________
                     50: 
                     51: Chapter 1. General Installation Considerations
                     52: 
                     53:    Before starting the installation, first you need to know what do you
                     54:    want to use PHP for. There are three main fields you can use PHP, as
                     55:    described in the What can PHP do? section:
                     56: 
                     57:      * Websites and web applications (server-side scripting)
                     58:      * Command line scripting
                     59:      * Desktop (GUI) applications
                     60: 
                     61:    For the first and most common form, you need three things: PHP itself,
                     62:    a web server and a web browser. You probably already have a web
                     63:    browser, and depending on your operating system setup, you may also
                     64:    have a web server (e.g. Apache on Linux and MacOS X; IIS on Windows).
                     65:    You may also rent webspace at a company. This way, you don't need to
                     66:    set up anything on your own, only write your PHP scripts, upload it to
                     67:    the server you rent, and see the results in your browser.
                     68: 
                     69:    In case of setting up the server and PHP on your own, you have two
                     70:    choices for the method of connecting PHP to the server. For many
                     71:    servers PHP has a direct module interface (also called SAPI). These
                     72:    servers include Apache, Microsoft Internet Information Server, Netscape
                     73:    and iPlanet servers. Many other servers have support for ISAPI, the
                     74:    Microsoft module interface (OmniHTTPd for example). If PHP has no
                     75:    module support for your web server, you can always use it as a CGI or
                     76:    FastCGI processor. This means you set up your server to use the CGI
                     77:    executable of PHP to process all PHP file requests on the server.
                     78: 
                     79:    If you are also interested to use PHP for command line scripting (e.g.
                     80:    write scripts autogenerating some images for you offline, or processing
                     81:    text files depending on some arguments you pass to them), you always
                     82:    need the command line executable. For more information, read the
                     83:    section about writing command line PHP applications. In this case, you
                     84:    need no server and no browser.
                     85: 
                     86:    With PHP you can also write desktop GUI applications using the PHP-GTK
                     87:    extension. This is a completely different approach than writing web
                     88:    pages, as you do not output any HTML, but manage Windows and objects
                     89:    within them. For more information about PHP-GTK, please visit the site
                     90:    dedicated to this extension. PHP-GTK is not included in the official
                     91:    PHP distribution.
                     92: 
                     93:    From now on, this section deals with setting up PHP for web servers on
                     94:    Unix and Windows with server module interfaces and CGI executables. You
                     95:    will also find information on the command line executable in the
                     96:    following sections.
                     97: 
                     98:    PHP source code and binary distributions for Windows can be found at
                     99:    http://www.php.net/downloads.php. We recommend you to choose a mirror
                    100:    nearest to you for downloading the distributions.
                    101:      __________________________________________________________________
                    102: 
                    103: Chapter 2. Installation on Windows systems
                    104: 
                    105:    This section applies to Windows 98/Me and Windows NT/2000/XP/2003. PHP
                    106:    will not work on 16 bit platforms such as Windows 3.1 and sometimes we
                    107:    refer to the supported Windows platforms as Win32. Windows 95 is no
                    108:    longer supported as of PHP 4.3.0.
                    109: 
                    110:    There are two main ways to install PHP for Windows: either manually or
                    111:    by using the installer.
                    112: 
                    113:    If you have Microsoft Visual Studio, you can also build PHP from the
                    114:    original source code.
                    115: 
                    116:    Once you have PHP installed on your Windows system, you may also want
                    117:    to load various extensions for added functionality.
                    118: 
                    119:    Warning
                    120: 
                    121:    There are several all-in-one installers over the Internet, but none of
                    122:    those are endorsed by PHP.net, as we believe that the manual
                    123:    installation is the best choice to have your system secure and
                    124:    optimised.
                    125:      __________________________________________________________________
                    126: 
                    127: Windows Installer (PHP 5.2 and later)
                    128: 
                    129:    The Windows PHP installer for later versions of PHP is built using MSI
                    130:    technology using the Wix Toolkit (http://wix.sourceforge.net/). It will
                    131:    install and configure PHP and all the built-in and PECL extensions, as
                    132:    well as configure many of the popular web servers such as IIS, Apache,
                    133:    and Xitami.
                    134: 
                    135:    First, install your selected HTTP (web) server on your system, and make
                    136:    sure that it works. Then proceed with one of the following install
                    137:    types.
                    138:      __________________________________________________________________
                    139: 
                    140: Normal Install
                    141: 
                    142:    Run the MSI installer and follow the instructions provided by the
                    143:    installation wizard. You will be prompted to select the Web Server you
                    144:    wish to configure first, along with any configuration details needed.
                    145: 
                    146:    You will then be prompted to select which features and extensions you
                    147:    wish to install and enable. By selecting "Will be installed on local
                    148:    hard drive" in the drop-down menu for each item you can trigger whether
                    149:    to install the feature or not. By selecting "Entire feature will be
                    150:    installed on local hard drive", you will be able to install all
                    151:    sub-features of the included feature ( for example by selecting this
                    152:    options for the feature "PDO" you will install all PDO Drivers ).
                    153: 
                    154:    Warning
                    155: 
                    156:    It is not recommended to install all extensions by default, since many
                    157:    other them require dependencies from outside PHP in order to function
                    158:    properly. Instead, use the Installation Repair Mode that can be
                    159:    triggered thru the 'Add/Remove Programs' control panel to enable or
                    160:    disable extensions and features after installation.
                    161: 
                    162:    The installer then sets up PHP to be used in Windows and the php.ini
                    163:    file, and configures certain web servers to use PHP. The installer will
                    164:    currently configure IIS (CGI mode only), Apache, Xitami, and Sambar
                    165:    Server; if you are using a different web server you'll need to
                    166:    configure it manually.
                    167:      __________________________________________________________________
                    168: 
                    169: Silent Install
                    170: 
                    171:    The installer also supports a silent mode, which is helpful for Systems
                    172:    Administrators to deploy PHP easily. To use silent mode:
                    173:    msiexec.exe /i php-VERSION-win32-install.msi /q
                    174: 
                    175:    You can control the install directory by passing it as a parameter to
                    176:    the install. For example, to install to e:\php:
                    177:    msiexec.exe /i php-VERSION-win32-install.msi /q INSTALLDIR=e:\php
                    178: 
                    179:    You can also use the same syntax to specify the Apache Configuration
                    180:    Directory (APACHEDIR), the Sambar Server directory (SAMBARDIR), and the
                    181:    Xitami Server directory (XITAMIDIR).
                    182: 
                    183:    You can also specify what features to install. For example, to install
                    184:    the mysqli extension and the CGI executable:
                    185:    msiexec.exe /i php-VERSION-win32-install.msi /q ADDLOCAL=cgi,ext_php_mysqli
                    186: 
                    187:    The current list of Features to install is as follows:
                    188: MainExecutable - php.exe executable
                    189: ScriptExecutable - php-win.exe executable
                    190: ext_php_* - the various extensions ( for example: ext_php_mysql for MySQL )
                    191: apache13 - Apache 1.3 module
                    192: apache20 - Apache 2.0 module
                    193: apache22 - Apache 2,2 module
                    194: apacheCGI - Apache CGI executable
                    195: iis4ISAPI - IIS ISAPI module
                    196: iis4CGI - IIS CGI executable
                    197: NSAPI - Sun/iPlanet/Netscape server module
                    198: Xitami - Xitami CGI executable
                    199: Sambar - Sambar Server ISAPI module
                    200: CGI - php-cgi.exe executable
                    201: PEAR - PEAR installer
                    202: Manual - PHP Manual in CHM Format
                    203: 
                    204:    For more information on installing MSI installers from the command
                    205:    line, visit
                    206:    http://msdn.microsoft.com/library/en-us/msi/setup/command_line_options.
                    207:    asp
                    208:      __________________________________________________________________
                    209: 
                    210: Windows Installer (PHP 5.1.0 and earlier)
                    211: 
                    212:    The Windows PHP installer is available from the downloads page at
                    213:    http://www.php.net/downloads.php. This installs the CGI version of PHP
                    214:    and for IIS, PWS, and Xitami, it configures the web server as well. The
                    215:    installer does not include any extra external PHP extensions
                    216:    (php_*.dll) as you'll only find those in the Windows Zip Package and
                    217:    PECL downloads.
                    218: 
                    219:      Note: While the Windows installer is an easy way to make PHP work,
                    220:      it is restricted in many aspects as, for example, the automatic
                    221:      setup of extensions is not supported. Use of the installer isn't the
                    222:      preferred method for installing PHP.
                    223: 
                    224:    First, install your selected HTTP (web) server on your system, and make
                    225:    sure that it works.
                    226: 
                    227:    Run the executable installer and follow the instructions provided by
                    228:    the installation wizard. Two types of installation are supported -
                    229:    standard, which provides sensible defaults for all the settings it can,
                    230:    and advanced, which asks questions as it goes along.
                    231: 
                    232:    The installation wizard gathers enough information to set up the
                    233:    php.ini file, and configure certain web servers to use PHP. One of the
                    234:    web servers the PHP installer does not configure for is Apache, so
                    235:    you'll need to configure it manually.
                    236: 
                    237:    Once the installation has completed, the installer will inform you if
                    238:    you need to restart your system, restart the server, or just start
                    239:    using PHP.
                    240: 
                    241:    Warning
                    242: 
                    243:    Be aware, that this setup of PHP is not secure. If you would like to
                    244:    have a secure PHP setup, you'd better go on the manual way, and set
                    245:    every option carefully. This automatically working setup gives you an
                    246:    instantly working PHP installation, but it is not meant to be used on
                    247:    online servers.
                    248:      __________________________________________________________________
                    249: 
                    250: Manual Installation Steps
                    251: 
                    252:    This install guide will help you manually install and configure PHP
                    253:    with a web server on Microsoft Windows. To get started you'll need to
                    254:    download the zip binary distribution from the downloads page at
                    255:    http://www.php.net/downloads.php.
                    256: 
                    257:    Although there are many all-in-one installation kits, and we also
                    258:    distribute a PHP installer for Microsoft Windows, we recommend you take
                    259:    the time to setup PHP yourself as this will provide you with a better
                    260:    understanding of the system, and enables you to install PHP extensions
                    261:    easily when needed.
                    262: 
                    263:      Upgrading from a previous PHP version: Previous editions of the
                    264:      manual suggest moving various ini and DLL files into your SYSTEM
                    265:      (i.e. C:\WINDOWS) folder and while this simplifies the installation
                    266:      procedure it makes upgrading difficult. We advise you remove all of
                    267:      these files (like php.ini and PHP related DLLs from the Windows
                    268:      SYSTEM folder) before moving on with a new PHP installation. Be sure
                    269:      to backup these files as you might break the entire system. The old
                    270:      php.ini might be useful in setting up the new PHP as well. And as
                    271:      you'll soon learn, the preferred method for installing PHP is to
                    272:      keep all PHP related files in one directory and have this directory
                    273:      available to your systems PATH.
                    274: 
                    275:      MDAC requirements: If you use Microsoft Windows 98/NT4 download the
                    276:      latest version of the Microsoft Data Access Components (MDAC) for
                    277:      your platform. MDAC is available at http://msdn.microsoft.com/data/.
                    278:      This requirement exists because ODBC is built into the distributed
                    279:      Windows binaries.
                    280: 
                    281:    The following steps should be completed on all installations before any
                    282:    server specific instructions are performed:
                    283: 
                    284:    Extract the distribution file into a directory of your choice. If you
                    285:    are installing PHP 4, extract to C:\, as the zip file expands to a
                    286:    foldername like php-4.3.7-Win32. If you are installing PHP 5, extract
                    287:    to C:\php as the zip file doesn't expand as in PHP 4. You may choose a
                    288:    different location but do not have spaces in the path (like C:\Program
                    289:    Files\PHP) as some web servers will crash if you do.
                    290: 
                    291:    The directory structure extracted from the zip is different for PHP
                    292:    versions 4 and 5 and look like as follows:
                    293: 
                    294:    Example 2-2. PHP 5 package structure
                    295: c:\php
                    296:    |
                    297:    +--dev
                    298:    |  |
                    299:    |  |-php5ts.lib
                    300:    |
                    301:    +--ext                 -- extension DLLs for PHP
                    302:    |  |
                    303:    |  |-php_bz2.dll
                    304:    |  |
                    305:    |  |-php_cpdf.dll
                    306:    |  |
                    307:    |  |-..
                    308:    |
                    309:    +--extras
                    310:    |  |
                    311:    |  +--mibs             -- support files for SNMP
                    312:    |  |
                    313:    |  +--openssl          -- support files for Openssl
                    314:    |  |
                    315:    |  +--pdf-related      -- support files for PDF
                    316:    |  |
                    317:    |  |-mime.magic
                    318:    |
                    319:    +--pear                -- initial copy of PEAR
                    320:    |
                    321:    |
                    322:    |-go-pear.bat          -- PEAR setup script
                    323:    |
                    324:    |-fdftk.dll
                    325:    |
                    326:    |-..
                    327:    |
                    328:    |-php-cgi.exe          -- CGI executable
                    329:    |
                    330:    |-php-win.exe          -- executes scripts without an opened command prompt
                    331:    |
                    332:    |-php.exe              -- CLI executable - ONLY for command line scripting
                    333:    |
                    334:    |-..
                    335:    |
                    336:    |-php.ini-development  -- development php.ini settings
                    337:    |
                    338:    |-php.ini-production   -- recommended php.ini settings for production
                    339:    |
                    340:    |-php5activescript.dll
                    341:    |
                    342:    |-php5apache.dll
                    343:    |
                    344:    |-php5apache2.dll
                    345:    |
                    346:    |-..
                    347:    |
                    348:    |-php5ts.dll           -- core PHP DLL
                    349:    |
                    350:    |-...
                    351: 
                    352:    Notice the differences and similarities. Both PHP 4 and PHP 5 have a
                    353:    CGI executable, a CLI executable, and server modules, but they are
                    354:    located in different folders and/or have different names. While PHP 4
                    355:    packages have the server modules in the sapi folder, PHP 5
                    356:    distributions have no such directory and instead they're in the PHP
                    357:    folder root. The supporting DLLs for the PHP 5 extensions are also not
                    358:    in a seperate directory.
                    359: 
                    360:      Note: In PHP 4, you should move all files located in the dll and
                    361:      sapi folders to the main folder (e.g. C:\php).
                    362: 
                    363:    Here is a list of server modules shipped with PHP 5:
                    364: 
                    365:      * sapi/php5apache2_2.dll - Apache 2.2.x module.
                    366:      * sapi/php5apache.dll (php5apache.dll) - Apache 1.x module
                    367:      * sapi/php5apache2.dll (php5apache2.dll) -  - Apache 2.0.x module.
                    368:      * sapi/php5isapi.dll - ISAPI Module for ISAPI compliant web servers 
                    369:        like IIS 5.0 or newer. However the FCGI SAPI is recommended with 
                    370:        IIS
                    371:      * sapi/php5nsapi.dll (php5nsapi.dll) - Sun/iPlanet/Netscape server
                    372:        module.
                    373: 
                    374:    Server modules provide significantly better performance and additional
                    375:    functionality compared to the CGI binary. The FastCGI is significantly
                    376:    more stable and can be faster than the ISAPI module with IIS.
                    377:    The CLI version is designed to let you use PHP for command line 
                    378:    scripting. More information about CLI is available in the chapter 
                    379:    about using PHP from the command line.
                    380: 
                    381:    Warning
                    382: 
                    383:    The SAPI modules have been significantly improved as of the 4.1
                    384:    release, however, in older systems you may encounter server errors or
                    385:    other server modules failing, such as ASP.
                    386: 
                    387:    The CGI and CLI binaries, and the web server modules all require the
                    388:    php5ts.dll file to be available to them. You have to make
                    389:    sure that this file can be found by your PHP installation. The search
                    390:    order for this DLL is as follows:
                    391: 
                    392:      * The same directory from where php.exe is called, or in case you use
                    393:        a SAPI module, the web server's directory (e.g. C:\Program
                    394:        Files\Apache Group\Apache2\bin).
                    395:      * Any directory in your Windows PATH environment variable.
                    396: 
                    397:    To make php5ts.dll available you have three options: copy
                    398:    the file to the Windows system directory, copy the file to the web
                    399:    server's directory, or add your PHP directory, C:\php to the PATH. For
                    400:    better maintenance, we advise you to follow the last option, add C:\php
                    401:    to the PATH, because it will be simpler to upgrade PHP in the future.
                    402:    Read more about how to add your PHP directory to PATH in the
                    403:    corresponding FAQ entry (and then don't forget to restart the computer
                    404:    - logoff isn't enough).
                    405: 
                    406:    The next step is to set up a valid configuration file for PHP, php.ini.
                    407:    There are two ini files distributed in the zip file, php.ini-development
                    408:    and php.ini-production. We advise you to use php.ini-production, 
                    409:    because we optimized the default settings in this file for performance, 
                    410:    and security. Read this well documented file carefully because it has
                    411:    changes from php.ini-production that will drastically affect your setup.
                    412:    Some examples are display_errors being off and magic_quotes_gpc being off.
                    413:    In addition to reading these, study the ini settings and set every
                    414:    element manually yourself. If you would like to achieve the best
                    415:    security, then this is the way for you, although PHP works fine with
                    416:    these default ini files. Copy your chosen ini-file to a directory that
                    417:    PHP is able to find and rename it to php.ini. PHP searches for php.ini
                    418:    in the locations described in the Section called The configuration file
                    419:    in Chapter 5 section.
                    420: 
                    421:    If you are running Apache 2, the simpler option is to use the PHPIniDir
                    422:    directive (read the installation on Apache 2 page), otherwise your best
                    423:    option is to set the PHPRC environment variable. This process is
                    424:    explained in the following FAQ entry.
                    425: 
                    426:      Note: If you're using NTFS on Windows NT, 2000, XP or 2003, make
                    427:      sure that the user running the web server has read permissions to
                    428:      your php.ini (e.g. make it readable by Everyone).
                    429: 
                    430:    The following steps are optional:
                    431: 
                    432:      * Edit your new php.ini file. If you plan to use OmniHTTPd, do not
                    433:        follow the next step. Set the doc_root to point to your web servers
                    434:        document_root. For example:
                    435: 
                    436: doc_root = c:\inetpub\wwwroot // for IIS/PWS
                    437: 
                    438: doc_root = c:\apache\htdocs // for Apache
                    439: 
                    440:      * Choose the extensions you would like to load when PHP starts. See
                    441:        the section about Windows extensions, about how to set up one, and
                    442:        what is already built in. Note that on a new installation it is
                    443:        advisable to first get PHP working and tested without any
                    444:        extensions before enabling them in php.ini.
                    445:      * On PWS and IIS, you can set the browscap configuration setting to
                    446:        point to: c:\windows\system\inetsrv\browscap.ini on Windows 9x/Me,
                    447:        c:\winnt\system32\inetsrv\browscap.ini on NT/2000, and
                    448:        c:\windows\system32\inetsrv\browscap.ini on XP. For an up-to-date
                    449:        browscap.ini, read the following FAQ.
                    450: 
                    451:    PHP is now setup on your system. The next step is to choose a web
                    452:    server, and enable it to run PHP. Choose a web server from the table of
                    453:    contents.
                    454:      __________________________________________________________________
                    455: 
                    456: ActiveScript
                    457: 
                    458:    This section contains notes specific to the ActiveScript installation.
                    459: 
                    460:    ActiveScript is a Windows only SAPI that enables you to use PHP script
                    461:    in any ActiveScript compliant host, like Windows Script Host,
                    462:    ASP/ASP.NET, Windows Script Components or Microsoft Scriptlet control.
                    463: 
                    464:    As of PHP 5.0.1, ActiveScript has been moved to the PECL repository.
                    465:    The DLL for this PECL extension may be downloaded from either the PHP
                    466:    Downloads page or from http://pecl4win.php.net/
                    467: 
                    468:      Note: You should read the manual installation steps first!
                    469: 
                    470:    After installing PHP, you should download the ActiveScript DLL
                    471:    (php5activescript.dll) and place it in the main PHP folder (e.g.
                    472:    C:\php).
                    473: 
                    474:    After having all the files needed, you must register the DLL on your
                    475:    system. To achieve this, open a Command Prompt window (located in the
                    476:    Start Menu). Then go to your PHP directory by typing something like cd
                    477:    C:\php. To register the DLL just type regsvr32 php5activescript.dll.
                    478: 
                    479:    To test if ActiveScript is working, create a new file, named test.wsf
                    480:    (the extension is very important) and type:
                    481: <job id="test">
                    482: 
                    483:  <script language="PHPScript">
                    484:   $WScript->Echo("Hello World!");
                    485:  </script>
                    486: 
                    487: </job>
                    488: 
                    489:    Save and double-click on the file. If you receive a little window
                    490:    saying "Hello World!" you're done.
                    491: 
                    492:      Note: In PHP 4, the engine was named 'ActivePHP', so if you are
                    493:      using PHP 4, you should replace 'PHPScript' with 'ActivePHP' in the
                    494:      above example.
                    495: 
                    496:      Note: ActiveScript doesn't use the default php.ini file. Instead, it
                    497:      will look only in the same directory as the .exe that caused it to
                    498:      load. You should create php-activescript.ini and place it in that
                    499:      folder, if you wish to load extensions, etc.
                    500:      __________________________________________________________________
                    501: 
                    502: Microsoft IIS / PWS
                    503: 
                    504:    This section contains notes and hints specific to IIS (Microsoft
                    505:    Internet Information Server).
                    506: 
                    507:    Warning
                    508: 
                    509:    By using the CGI setup, your server is open to several possible
                    510:    attacks. Please read our CGI security section to learn how to defend
                    511:    yourself from those attacks.
                    512:      __________________________________________________________________
                    513: 
                    514: General considerations for all installations of PHP with IIS or PWS
                    515: 
                    516:      * First, read the Manual Installation Instructions. Do not skip this
                    517:        step as it provides crucial information for installing PHP on
                    518:        Windows.
                    519:      * CGI users must set the cgi.force_redirect PHP directive to 0 inside
                    520:        php.ini. Read the faq on cgi.force_redirect for important details.
                    521:        Also, CGI users may want to set the cgi.redirect_status_env
                    522:        directive. When using directives, be sure these directives aren't
                    523:        commented out inside php.ini.
                    524:      * The PHP 4 CGI is named php.exe while in PHP 5 it's php-cgi.exe. In
                    525:        PHP 5, php.exe is the CLI, and not the CGI.
                    526:      * Modify the Windows PATH environment variable to include the PHP
                    527:        directory. This way the PHP DLL files and PHP executables can all
                    528:        remain in the PHP directory without cluttering up the Windows
                    529:        system directory. For more details, see the FAQ on Setting the
                    530:        PATH.
                    531:      * The IIS user (usually IUSR_MACHINENAME) needs permission to read
                    532:        various files and directories, such as php.ini, docroot, and the
                    533:        session tmp directory.
                    534:      * Be sure the extension_dir and doc_root PHP directives are
                    535:        appropriately set in php.ini. These directives depend on the system
                    536:        that PHP is being installed on. In PHP 4, the extension_dir is
                    537:        extensions while with PHP 5 it's ext. So, an example PHP 5
                    538:        extensions_dir value is "c:\php\ext" and an example IIS doc_root
                    539:        value is "c:\Inetpub\wwwroot".
                    540:      * PHP extension DLL files, such as php_mysql.dll and php_curl.dll,
                    541:        are found in the zip package of the PHP download (not the PHP
                    542:        installer). In PHP 5, many extensions are part of PECL and can be
                    543:        downloaded in the "Collection of PECL modules" package. Files such
                    544:        as php_zip.dll and php_ssh2.dll. Download PHP files here.
                    545:      * When defining the executable, the 'check that file exists' box may
                    546:        also be checked. For a small performance penalty, the IIS (or PWS)
                    547:        will check that the script file exists and sort out authentication
                    548:        before firing up PHP. This means that the web server will provide
                    549:        sensible 404 style error messages instead of CGI errors complaining
                    550:        that PHP did not output any data.
                    551:      __________________________________________________________________
                    552: 
                    553: Windows NT/200x/XP and IIS 4 or newer
                    554: 
                    555:    PHP may be installed as a CGI binary, or with the ISAPI module. In
                    556:    either case, you need to start the Microsoft Management Console (may
                    557:    appear as 'Internet Services Manager', either in your Windows NT 4.0
                    558:    Option Pack branch or the Control Panel=>Administrative Tools under
                    559:    Windows 2000/XP). Then right click on your Web server node (this will
                    560:    most probably appear as 'Default Web Server'), and select 'Properties'.
                    561: 
                    562:    If you want to use the CGI binary, do the following:
                    563: 
                    564:      * Under 'Home Directory', 'Virtual Directory', or 'Directory', do the
                    565:        following:
                    566:      * Change the Execute Permissions to 'Scripts only'
                    567:      * Click on the 'Configuration' button, and choose the Application
                    568:        Mappings tab. Click Add and set the Executable path to the
                    569:        appropriate CGI file. An example PHP 5 value is: C:\php\php-cgi.exe
                    570:        Supply .php as the extension. Leave 'Method exclusions' blank, and
                    571:        check the 'Script engine' checkbox. Now, click OK a few times.
                    572:      * Set up the appropriate security. (This is done in Internet Service
                    573:        Manager), and if your NT Server uses NTFS file system, add execute
                    574:        rights for I_USR_ to the directory that contains php.exe /
                    575:        php-cgi.exe.
                    576: 
                    577:    To use the ISAPI module, do the following:
                    578: 
                    579:      * If you don't want to perform HTTP Authentication using PHP, you can
                    580:        (and should) skip this step. Under ISAPI Filters, add a new ISAPI
                    581:        filter. Use PHP as the filter name, and supply a path to the
                    582:        php5isapi.dll.
                    583:      * Under 'Home Directory', 'Virtual Directory', or 'Directory', do the
                    584:        following:
                    585:      * Change the Execute Permissions to 'Scripts only'
                    586:      * Click on the 'Configuration' button, and choose the Application
                    587:        Mappings tab. Click Add and set the Executable path to the
                    588:        appropriate ISAPI DLL. An example PHP 5 value is:
                    589:        C:\php\php5isapi.dll Supply .php as the extension. Leave 'Method
                    590:        exclusions' blank, and check the 'Script engine' checkbox. Now,
                    591:        click OK a few times.
                    592:      * Stop IIS completely (NET STOP iisadmin)
                    593:      * Start IIS again (NET START w3svc)
                    594: 
                    595:    With IIS 6 (2003 Server), open up the IIS Manager, go to Web Service
                    596:    Extensions, choose "Add a new Web service extension", enter in a name
                    597:    such as PHP, choose the Add button and for the value browse to either
                    598:    the ISAPI file (php5isapi.dll) or CGI (php.exe or
                    599:    php-cgi.exe) then check "Set extension status to Allowed" and click OK.
                    600: 
                    601:    In order to use index.php as a default content page, do the following:
                    602:    From within the Documents tab, choose Add. Type in index.php and click
                    603:    OK. Adjust the order by choosing Move Up or Move Down. This is similar
                    604:    to setting DirectoryIndex with Apache.
                    605: 
                    606:    The steps above must be repeated for each extension that is to be
                    607:    associated with PHP scripts. .php is the most common although .php3 may
                    608:    be required for legacy applications.
                    609: 
                    610:    If you experience 100% CPU usage after some time, turn off the IIS
                    611:    setting Cache ISAPI Application.
                    612:      __________________________________________________________________
                    613: 
                    614: Windows and IIS
                    615: 
                    616: See http://www.php.net/install.windows
                    617:      __________________________________________________________________
                    618: 
                    619: Apache 1.3.x on Microsoft Windows
                    620: 
                    621:    This section contains notes and hints specific to Apache 1.3.x installs
                    622:    of PHP on Microsoft Windows systems. There are also instructions and
                    623:    notes for Apache 2 on a separate page.
                    624: 
                    625:      Note: Please read the manual installation steps first!
                    626: 
                    627:    There are two ways to set up PHP to work with Apache 1.3.x on Windows.
                    628:    One is to use the CGI binary (php.exe for PHP 4 and php-cgi.exe for PHP
                    629:    5), the other is to use the Apache Module DLL. In either case you need
                    630:    to edit your httpd.conf to configure Apache to work with PHP, and then
                    631:    restart the server.
                    632: 
                    633:    It is worth noting here that now the SAPI module has been made more
                    634:    stable under Windows, we recommend it's use above the CGI binary, since
                    635:    it is more transparent and secure.
                    636: 
                    637:    Although there can be a few variations of configuring PHP under Apache,
                    638:    these are simple enough to be used by the newcomer. Please consult the
                    639:    Apache Documentation for further configuration directives.
                    640: 
                    641:    After changing the configuration file, remember to restart the server,
                    642:    for example, NET STOP APACHE followed by NET START APACHE, if you run
                    643:    Apache as a Windows Service, or use your regular shortcuts.
                    644: 
                    645:      Note: Remember that when adding path values in the Apache
                    646:      configuration files on Windows, all backslashes such as
                    647:      c:\directory\file.ext must be converted to forward slashes, as
                    648:      c:/directory/file.ext. A trailing slash may also be necessary for
                    649:      directories.
                    650:      __________________________________________________________________
                    651: 
                    652: Installing as an Apache module
                    653: 
                    654:    You should add the following lines to your Apache httpd.conf file:
                    655: 
                    656:    Example 2-3. PHP as an Apache 1.3.x module
                    657: 
                    658:    This assumes PHP is installed to c:\php. Adjust the path if this is not
                    659:    the case.
                    660: 
                    661:    For PHP 5:
                    662: # Add to the end of the LoadModule section
                    663: LoadModule php5_module "C:/php/php5apache.dll"
                    664: 
                    665: # Add to the end of the AddModule section
                    666: AddModule mod_php5.c
                    667: 
                    668:    For both:
                    669: # Add this line inside the <IfModule mod_mime.c> conditional brace
                    670: AddType application/x-httpd-php .php
                    671: 
                    672: # For syntax highlighted .phps files, also add
                    673: AddType application/x-httpd-php-source .phps
                    674:      __________________________________________________________________
                    675: 
                    676: Installing as a CGI binary
                    677: 
                    678:    If you unzipped the PHP package to C:\php\ as described in the Manual
                    679:    Installation Steps section, you need to insert these lines to your
                    680:    Apache configuration file to set up the CGI binary:
                    681: 
                    682:    Example 2-4. PHP and Apache 1.3.x as CGI
                    683: ScriptAlias /php/ "c:/php/"
                    684: AddType application/x-httpd-php .php
                    685: 
                    686: # For PHP 4
                    687: Action application/x-httpd-php "/php/php.exe"
                    688: 
                    689: # For PHP 5
                    690: Action application/x-httpd-php "/php/php-cgi.exe"
                    691: 
                    692: # specify the directory where php.ini is
                    693: SetEnv PHPRC C:/php
                    694: 
                    695:    Note that the second line in the list above can be found in the actual
                    696:    versions of httpd.conf, but it is commented out. Remember also to
                    697:    substitute the c:/php/ for your actual path to PHP.
                    698: 
                    699:    Warning
                    700: 
                    701:    By using the CGI setup, your server is open to several possible
                    702:    attacks. Please read our CGI security section to learn how to defend
                    703:    yourself from those attacks.
                    704: 
                    705:    If you would like to present PHP source files syntax highlighted, there
                    706:    is no such convenient option as with the module version of PHP. If you
                    707:    chose to configure Apache to use PHP as a CGI binary, you will need to
                    708:    use the highlight_file() function. To do this simply create a PHP
                    709:    script file and add this code: <?php
                    710:    highlight_file('some_php_script.php'); ?>.
                    711:      __________________________________________________________________
                    712: 
                    713: Apache 2.0.x on Microsoft Windows
                    714: 
                    715:    This section contains notes and hints specific to Apache 2.0.x installs
                    716:    of PHP on Microsoft Windows systems. We also have instructions and
                    717:    notes for Apache 1.3.x users on a separate page.
                    718: 
                    719:      Note: You should read the manual installation steps first!
                    720: 
                    721:      Apache 2.2.x Support: Users of Apache 2.2.x may use the
                    722:      documentation below except the appropriate DLL file is named
                    723:      php5apache2_2.dll and it only exists as of PHP 5.2.0. See also
                    724:      http://snaps.php.net/
                    725: 
                    726:    Warning
                    727: 
                    728:    We do not recommend using a threaded MPM in production with Apache2.
                    729:    Use the prefork MPM instead, or use Apache1. For information on why,
                    730:    read the related FAQ entry on using Apache2 with a threaded MPM
                    731: 
                    732:    You are highly encouraged to take a look at the Apache Documentation to
                    733:    get a basic understanding of the Apache 2.0.x Server. Also consider to
                    734:    read the Windows specific notes for Apache 2.0.x before reading on
                    735:    here.
                    736: 
                    737:      PHP and Apache 2.0.x compatibility notes: The following versions of
                    738:      PHP are known to work with the most recent version of Apache 2.0.x:
                    739: 
                    740:      * PHP 4.3.0 or later available at http://www.php.net/downloads.php.
                    741:      * the latest stable development version. Get the source code
                    742:        http://snaps.php.net/php5-latest.tar.gz or download binaries for
                    743:        Windows http://snaps.php.net/win32/php5-win32-latest.zip.
                    744:      * a prerelease version downloadable from http://qa.php.net/.
                    745:      * you have always the option to obtain PHP through SVN.
                    746: 
                    747:      These versions of PHP are compatible to Apache 2.0.40 and later.
                    748: 
                    749:      Apache 2.0 SAPI-support started with PHP 4.2.0. PHP 4.2.3 works with
                    750:      Apache 2.0.39, don't use any other version of Apache with PHP 4.2.3.
                    751:      However, the recommended setup is to use PHP 4.3.0 or later with the
                    752:      most recent version of Apache2.
                    753: 
                    754:      All mentioned versions of PHP will work still with Apache 1.3.x.
                    755: 
                    756:    Warning
                    757: 
                    758:    Apache 2.0.x is designed to run on Windows NT 4.0, Windows 2000 or
                    759:    Windows XP. At this time, support for Windows 9x is incomplete. Apache
                    760:    2.0.x is not expected to work on those platforms at this time.
                    761: 
                    762:    Download the most recent version of Apache 2.0.x and a fitting PHP
                    763:    version. Follow the Manual Installation Steps and come back to go on
                    764:    with the integration of PHP and Apache.
                    765: 
                    766:    There are two ways to set up PHP to work with Apache 2.0.x on Windows.
                    767:    One is to use the CGI binary the other is to use the Apache module DLL.
                    768:    In either case you need to edit your httpd.conf to configure Apache to
                    769:    work with PHP and then restart the server.
                    770: 
                    771:      Note: Remember that when adding path values in the Apache
                    772:      configuration files on Windows, all backslashes such as
                    773:      c:\directory\file.ext must be converted to forward slashes, as
                    774:      c:/directory/file.ext. A trailing slash may also be necessary for
                    775:      directories.
                    776:      __________________________________________________________________
                    777: 
                    778: Installing as a CGI binary
                    779: 
                    780:    You need to insert these three lines to your Apache httpd.conf
                    781:    configuration file to set up the CGI binary:
                    782: 
                    783:    Example 2-5. PHP and Apache 2.0 as CGI
                    784: ScriptAlias /php/ "c:/php/"
                    785: AddType application/x-httpd-php .php
                    786: 
                    787: # For PHP 4
                    788: Action application/x-httpd-php "/php/php.exe"
                    789: 
                    790: # For PHP 5
                    791: Action application/x-httpd-php "/php/php-cgi.exe"
                    792: 
                    793:    Warning
                    794: 
                    795:    By using the CGI setup, your server is open to several possible
                    796:    attacks. Please read our CGI security section to learn how to defend
                    797:    yourself from those attacks.
                    798:      __________________________________________________________________
                    799: 
                    800: Installing as an Apache module
                    801: 
                    802:    You need to insert these two lines to your Apache httpd.conf
                    803:    configuration file to set up the PHP module for Apache 2.0:
                    804: 
                    805:    Example 2-6. PHP and Apache 2.0 as Module
                    806: 
                    807: # For PHP 5 do something like this:
                    808: LoadModule php5_module "c:/php/php5apache2.dll"
                    809: AddType application/x-httpd-php .php
                    810: 
                    811: # configure the path to php.ini
                    812: PHPIniDir "C:/php"
                    813: 
                    814:      Note: Remember to substitute your actual path to PHP for the c:/php/
                    815:      in the above examples. Take care to use either 
                    816:      php5apache2.dll in your LoadModule directive and not php5apache.dll 
                    817:      as the latter ones are designed to run with Apache 1.3.x.
                    818: 
                    819:      Note: If you want to use content negotiation, read related FAQ.
                    820: 
                    821:    Warning
                    822: 
                    823:    Don't mix up your installation with DLL files from different PHP
                    824:    versions. You have the only choice to use the DLL's and extensions that
                    825:    ship with your downloaded PHP version.
                    826:      __________________________________________________________________
                    827: 
                    828: Sun, iPlanet and Netscape servers on Microsoft Windows
                    829: 
                    830:    This section contains notes and hints specific to Sun Java System Web
                    831:    Server, Sun ONE Web Server, iPlanet and Netscape server installs of PHP
                    832:    on Windows.
                    833: 
                    834:    From PHP 4.3.3 on you can use PHP scripts with the NSAPI module to
                    835:    generate custom directory listings and error pages. Additional
                    836:    functions for Apache compatibility are also available. For support in
                    837:    current web servers read the note about subrequests.
                    838:      __________________________________________________________________
                    839: 
                    840: CGI setup on Sun, iPlanet and Netscape servers
                    841: 
                    842:    To install PHP as a CGI handler, do the following:
                    843: 
                    844:      * Copy php5ts.dll to your systemroot (the directory where you
                    845:        installed Windows)
                    846:      * Make a file association from the command line. Type the following
                    847:        two lines:
                    848: 
                    849: assoc .php=PHPScript
                    850: ftype PHPScript=c:\php\php.exe %1 %*
                    851: 
                    852:      * In the Netscape Enterprise Administration Server create a dummy
                    853:        shellcgi directory and remove it just after (this step creates 5
                    854:        important lines in obj.conf and allow the web server to handle
                    855:        shellcgi scripts).
                    856:      * In the Netscape Enterprise Administration Server create a new mime
                    857:        type (Category: type, Content-Type: magnus-internal/shellcgi, File
                    858:        Suffix:php).
                    859:      * Do it for each web server instance you want PHP to run
                    860: 
                    861:    More details about setting up PHP as a CGI executable can be found
                    862:    here: http://benoit.noss.free.fr/php/install-php.html
                    863:      __________________________________________________________________
                    864: 
                    865: NSAPI setup on Sun, iPlanet and Netscape servers
                    866: 
                    867:    To install PHP with NSAPI, do the following:
                    868: 
                    869:      * Copy php5ts.dll to your systemroot (the directory where you
                    870:        installed Windows)
                    871:      * Make a file association from the command line. Type the following
                    872:        two lines:
                    873: 
                    874: assoc .php=PHPScript
                    875: ftype PHPScript=c:\php\php.exe %1 %*
                    876: 
                    877:      * In the Netscape Enterprise Administration Server create a new mime
                    878:        type (Category: type, Content-Type: magnus-internal/x-httpd-php,
                    879:        File Suffix: php).
                    880:      * Edit magnus.conf (for servers >= 6) or obj.conf (for servers < 6)
                    881:        and add the following: You should place the lines after mime types
                    882:        init.
                    883: 
                    884: Init fn="load-modules" funcs="php5_init,php5_execute,php5_auth_trans" shlib="c:/
                    885: php/sapi/php5nsapi.dll"
                    886: Init fn="php5_init" LateInit="yes" errorString="Failed to initialise PHP!" [php_
                    887: ini="c:/path/to/php.ini"]
                    888: 
                    889:        The php_ini parameter is optional but with it you
                    890:        can place your php.ini in your web server configuration directory.
                    891:      * Configure the default object in obj.conf (for virtual server
                    892:        classes [Sun Web Server 6.0+] in their vserver.obj.conf): In the
                    893:        <Object name="default"> section, place this line necessarily after
                    894:        all 'ObjectType' and before all 'AddLog' lines:
                    895: 
                    896: Service fn="php5_execute" type="magnus-internal/x-httpd-php" [inikey=value inike
                    897: y=value ...]
                    898: 
                    899:        As additional parameters you can add some special
                    900:        php.ini-values, for example you can set a
                    901:        docroot="/path/to/docroot" specific to the context php5_execute is
                    902:        called. For boolean ini-keys please use 0/1 as value, not
                    903:        "On","Off",... (this will not work correctly), e.g.
                    904:        zlib.output_compression=1 instead of zlib.output_compression="On"
                    905:      * This is only needed if you want to configure a directory that only
                    906:        consists of PHP scripts (same like a cgi-bin directory):
                    907: 
                    908: <Object name="x-httpd-php">
                    909: ObjectType fn="force-type" type="magnus-internal/x-httpd-php"
                    910: Service fn=php5_execute [inikey=value inikey=value ...]
                    911: </Object>
                    912: 
                    913:        After that you can configure a directory in the Administration
                    914:        server and assign it the style x-httpd-php. All files in it will
                    915:        get executed as PHP. This is nice to hide PHP usage by renaming
                    916:        files to .html.
                    917:      * Restart your web service and apply changes
                    918:      * Do it for each web server instance you want PHP to run
                    919: 
                    920:      Note: More details about setting up PHP as an NSAPI filter can be
                    921:      found here: http://benoit.noss.free.fr/php/install-php4.html
                    922: 
                    923:      Note: The stacksize that PHP uses depends on the configuration of
                    924:      the web server. If you get crashes with very large PHP scripts, it
                    925:      is recommended to raise it with the Admin Server (in the section
                    926:      "MAGNUS EDITOR").
                    927:      __________________________________________________________________
                    928: 
                    929: CGI environment and recommended modifications in php.ini
                    930: 
                    931:    Important when writing PHP scripts is the fact that Sun JSWS/Sun ONE
                    932:    WS/iPlanet/Netscape is a multithreaded web server. Because of that all
                    933:    requests are running in the same process space (the space of the web
                    934:    server itself) and this space has only one environment. If you want to
                    935:    get CGI variables like PATH_INFO, HTTP_HOST etc. it is not the correct
                    936:    way to try this in the old PHP 3.x way with getenv() or a similar way
                    937:    (register globals to environment, $_ENV). You would only get the
                    938:    environment of the running web server without any valid CGI variables!
                    939: 
                    940:      Note: Why are there (invalid) CGI variables in the environment?
                    941: 
                    942:      Answer: This is because you started the web server process from the
                    943:      admin server which runs the startup script of the web server, you
                    944:      wanted to start, as a CGI script (a CGI script inside of the admin
                    945:      server!). This is why the environment of the started web server has
                    946:      some CGI environment variables in it. You can test this by starting
                    947:      the web server not from the administration server. Use the command
                    948:      line as root user and start it manually - you will see there are no
                    949:      CGI-like environment variables.
                    950:      __________________________________________________________________
                    951: 
                    952: Special use for error pages or self-made directory listings (PHP >= 4.3.3)
                    953: 
                    954:    You can use PHP to generate the error pages for "404 Not Found" or
                    955:    similar. Add the following line to the object in obj.conf for every
                    956:    error page you want to overwrite:
                    957: Error fn="php5_execute" code=XXX script="/path/to/script.php" [inikey=value inik
                    958: ey=value...]
                    959: 
                    960:    where XXX is the HTTP error code. Please delete any other Error
                    961:    directives which could interfere with yours. If you want to place a
                    962:    page for all errors that could exist, leave the code parameter out.
                    963:    Your script can get the HTTP status code with $_SERVER['ERROR_TYPE'].
                    964: 
                    965:    Another possibility is to generate self-made directory listings. Just
                    966:    create a PHP script which displays a directory listing and replace the
                    967:    corresponding default Service line for type="magnus-internal/directory"
                    968:    in obj.conf with the following:
                    969: Service fn="php5_execute" type="magnus-internal/directory" script="/path/to/scri
                    970: pt.php" [inikey=value inikey=value...]
                    971: 
                    972:    For both error and directory listing pages the original URI and
                    973:    translated URI are in the variables $_SERVER['PATH_INFO'] and
                    974:    $_SERVER['PATH_TRANSLATED'].
                    975:      __________________________________________________________________
                    976: 
                    977: Note about nsapi_virtual() and subrequests (PHP >= 4.3.3)
                    978: 
                    979:    The NSAPI module now supports the nsapi_virtual() function (alias:
                    980:    virtual()) to make subrequests on the web server and insert the result
                    981:    in the web page. The problem is, that this function uses some
                    982:    undocumented features from the NSAPI library.
                    983: 
                    984:    Under Unix this is not a problem, because the module automatically
                    985:    looks for the needed functions and uses them if available. If not,
                    986:    nsapi_virtual() is disabled.
                    987: 
                    988:    Under Windows limitations in the DLL handling need the use of a
                    989:    automatic detection of the most recent ns-httpdXX.dll file. This is
                    990:    tested for servers till version 6.1. If a newer version of the Sun
                    991:    server is used, the detection fails and nsapi_virtual() is disabled.
                    992: 
                    993:    If this is the case, try the following: Add the following parameter to
                    994:    php5_init in magnus.conf/obj.conf:
                    995:    Init fn=php5_init ... server_lib="ns-httpdXX.dll"
                    996: 
                    997:    where XX is the correct DLL version number. To get it, look in the
                    998:    server-root for the correct DLL name. The DLL with the biggest filesize
                    999:    is the right one.
                   1000: 
                   1001:    You can check the status by using the phpinfo() function.
                   1002: 
                   1003:      Note: But be warned: Support for nsapi_virtual() is EXPERIMENTAL!!!
                   1004:      __________________________________________________________________
                   1005: 
                   1006: OmniHTTPd Server
                   1007: 
                   1008:    This section contains notes and hints specific to OmniHTTPd on Windows.
                   1009: 
                   1010:      Note: You should read the manual installation steps first!
                   1011: 
                   1012:    Warning
                   1013: 
                   1014:    By using the CGI setup, your server is open to several possible
                   1015:    attacks. Please read our CGI security section to learn how to defend
                   1016:    yourself from those attacks.
                   1017: 
                   1018:    You need to complete the following steps to make PHP work with
                   1019:    OmniHTTPd. This is a CGI executable setup. SAPI is supported by
                   1020:    OmniHTTPd, but some tests have shown that it is not so stable to use
                   1021:    PHP as an ISAPI module.
                   1022: 
                   1023:      Important for CGI users: Read the faq on cgi.force_redirect for
                   1024:      important details. This directive needs to be set to 0.
                   1025: 
                   1026:     1. Install OmniHTTPd server.
                   1027:     2. Right click on the blue OmniHTTPd icon in the system tray and
                   1028:        select Properties
                   1029:     3. Click on Web Server Global Settings
                   1030:     4. On the 'External' tab, enter: virtual = .php | actual =
                   1031:        c:\php\php.exe (use php-cgi.exe if installing PHP 5), and use the
                   1032:        Add button.
                   1033:     5. On the Mime tab, enter: virtual = wwwserver/stdcgi | actual = .php,
                   1034:        and use the Add button.
                   1035:     6. Click OK
                   1036: 
                   1037:    Repeat steps 2 - 6 for each extension you want to associate with PHP.
                   1038: 
                   1039:      __________________________________________________________________
                   1040: 
                   1041: Xitami on Microsoft Windows
                   1042: 
                   1043:    This section contains notes and hints specific to Xitami on Windows.
                   1044: 
                   1045:      Note: You should read the manual installation steps first!
                   1046: 
                   1047:    This list describes how to set up the PHP CGI binary to work with
                   1048:    Xitami on Windows.
                   1049: 
                   1050:      Important for CGI users: Read the faq on cgi.force_redirect for
                   1051:      important details. This directive needs to be set to 0. If you want
                   1052:      to use $_SERVER['PHP_SELF'] you have to enable the cgi.fix_pathinfo
                   1053:      directive.
                   1054: 
                   1055:    Warning
                   1056: 
                   1057:    By using the CGI setup, your server is open to several possible
                   1058:    attacks. Please read our CGI security section to learn how to defend
                   1059:    yourself from those attacks.
                   1060: 
                   1061:      * Make sure the web server is running, and point your browser to
                   1062:        xitamis admin console (usually http://127.0.0.1/admin), and click
                   1063:        on Configuration.
                   1064:      * Navigate to the Filters, and put the extension which PHP should
                   1065:        parse (i.e. .php) into the field File extensions (.xxx).
                   1066:      * In Filter command or script put the path and name of your PHP CGI
                   1067:        executable i.e. C:\php\php-cgi.exe.
                   1068:      * Press the 'Save' icon.
                   1069:      * Restart the server to reflect changes.
                   1070:      __________________________________________________________________
                   1071: 
                   1072: Installation of extensions on Windows
                   1073: 
                   1074:    After installing PHP and a web server on Windows, you will probably
                   1075:    want to install some extensions for added functionality. You can choose
                   1076:    which extensions you would like to load when PHP starts by modifying
                   1077:    your php.ini. You can also load a module dynamically in your script
                   1078:    using dl().
                   1079: 
                   1080:    The DLLs for PHP extensions are prefixed with php_.
                   1081: 
                   1082:    Many extensions are built into the Windows version of PHP. This means
                   1083:    additional DLL files, and the extension directive, are not used to load
                   1084:    these extensions. The Windows PHP Extensions table lists extensions
                   1085:    that require, or used to require, additional PHP DLL files. Here's a
                   1086:    list of built in extensions:
                   1087: 
                   1088:    In PHP 5 (updated PHP 5.0.4), the following changes exist. Built in:
                   1089:    DOM, LibXML, Iconv, SimpleXML, SPL and SQLite. And the following are no
                   1090:    longer built in: MySQL and Overload.
                   1091: 
                   1092:    The default location PHP searches for extensions is C:\php5 in PHP 5. 
                   1093:    To change this setting to reflect your setup of PHP edit your php.ini
                   1094:    file:
                   1095: 
                   1096:      * You will need to change the extension_dir setting to point to the
                   1097:        directory where your extensions lives, or where you have placed
                   1098:        your php_*.dll files. For example:
                   1099: 
                   1100: extension_dir = C:\php\extensions
                   1101: 
                   1102:      * Enable the extension(s) in php.ini you want to use by uncommenting
                   1103:        the extension=php_*.dll lines in php.ini. This is done by deleting
                   1104:        the leading ; from the extension you want to load.
                   1105: 
                   1106:    Example 2-8. Enable Bzip2 extension for PHP-Windows
                   1107: // change the following line from ...
                   1108: ;extension=php_bz2.dll
                   1109: 
                   1110: // ... to
                   1111: extension=php_bz2.dll
                   1112: 
                   1113:      * Some of the extensions need extra DLLs to work. Couple of them can
                   1114:        be found in the distribution package, in in the main folder in PHP 5, 
                   1115:        but some, for example Oracle (php_oci8.dll) require DLLs which are 
                   1116:        not bundled with the distribution package.
                   1117:      * Some of these DLLs are not bundled with the PHP distribution. See
                   1118:        each extensions documentation page for details. Also, read the
                   1119:        manual section titled Installation of PECL extensions for details
                   1120:        on PECL. An increasingly large number of PHP extensions are found
                   1121:        in PECL, and these extensions require a separate download.
                   1122: 
                   1123:      Note: If you are running a server module version of PHP remember to
                   1124:      restart your web server to reflect your changes to php.ini.
                   1125: 
                   1126:    The following table describes some of the extensions available and
                   1127:    required additional dlls.
                   1128: 
                   1129:    Table 2-1. PHP Extensions
                   1130:    Extension Description Notes
                   1131:    php_bz2.dll bzip2 compression functions None
                   1132:    php_calendar.dll Calendar conversion functions
                   1133:    php_cpdf.dll ClibPDF functions None
                   1134:    php_crack.dll Crack functions None
                   1135:    php_ctype.dll ctype family functions
                   1136:    php_curl.dll CURL, Client URL library functions Requires: libeay32.dll,
                   1137:    ssleay32.dll (bundled)
                   1138:    php_db.dll DBM functions Deprecated. Use DBA instead (php_dba.dll)
                   1139:    php_dba.dll DBA: DataBase (dbm-style) Abstraction layer functions None
                   1140:    php_dbase.dll dBase functions None
                   1141:    php_dbx.dll dbx functions
                   1142:    php_exif.dll EXIF functions php_mbstring.dll. And, php_exif.dll must be
                   1143:    loaded after php_mbstring.dll in php.ini.
                   1144:    php_fdf.dll FDF: Forms Data Format functions. Requires: fdftk.dll
                   1145:    (bundled)
                   1146:    php_filepro.dll filePro functions Read-only access
                   1147:    php_ftp.dll FTP functions
                   1148:    php_gd2.dll GD library image functions GD2
                   1149:    php_gettext.dll Gettext functions, requires libintl-1.dll, 
                   1150:    iconv.dll (bundled).
                   1151:    php_iconv.dll ICONV characterset conversion Requires: iconv.dll
                   1152:    php_imap.dll IMAP POP3 and NNTP functions None
                   1153:    php_interbase.dll InterBase functions Requires: gds32.dll (bundled)
                   1154:    php_ldap.dll LDAP functions requires libeay32.dll, ssleay32.dll (bundled)
                   1155:    php_mbstring.dll Multi-Byte String functions None
                   1156:    php_mcrypt.dll Mcrypt Encryption functions Requires: libmcrypt.dll
                   1157:    php_mime_magic.dll Mimetype functions Requires: magic.mime (bundled)
                   1158:    php_ming.dll Ming functions for Flash None
                   1159:    php_msql.dll mSQL functions Requires: msql.dll (bundled)
                   1160:    php_mssql.dll MSSQL functions Requires: ntwdblib.dll (bundled)
                   1161:    php_mysql.dll MySQL functions PHP >= 5.0.0, requires libmysql.dll
                   1162:    (bundled)
                   1163:    php_mysqli.dll MySQLi functions PHP >= 5.0.0, requires libmysql.dll
                   1164:    (libmysqli.dll in PHP <= 5.0.2) (bundled)
                   1165:    php_oci8.dll Oracle 8 functions Requires: Oracle 8.1+ client libraries
                   1166:    php_openssl.dll OpenSSL functions Requires: libeay32.dll (bundled)
                   1167:    php_oracle.dll Oracle functions Requires: Oracle 7 client libraries
                   1168:    php_pgsql.dll PostgreSQL functions None
                   1169:    php_printer.dll Printer functions None
                   1170:    php_shmop.dll Shared Memory functions None
                   1171:    php_snmp.dll SNMP get and walk functions NT only!
                   1172:    php_soap.dll SOAP functions PHP >= 5.0.0
                   1173:    php_sockets.dll Socket functions None
                   1174:    php_sybase_ct.dll Sybase functions Requires: Sybase client libraries
                   1175:    php_tidy.dll Tidy functions PHP >= 5.0.0
                   1176:    php_tokenizer.dll Tokenizer functions Built in since PHP 4.3.0
                   1177:    php_xmlrpc.dll XML-RPC functions PHP >= 4.2.1 requires: iconv.dll
                   1178:    (bundled)
                   1179:    php_xslt.dll XSLT requires libxslt.dll, iconv.dll (bundled).
                   1180:    php_zip.dll Zip File functions
                   1181:    php_zlib.dll ZLib compression functions
                   1182:      __________________________________________________________________
                   1183: 
                   1184: Chapter 3. Installation of PECL extensions
                   1185: 
                   1186: Introduction to PECL Installations
                   1187: 
                   1188:    PECL is a repository of PHP extensions that are made available to you
                   1189:    via the PEAR packaging system. This section of the manual is intended
                   1190:    to demonstrate how to obtain and install PECL extensions.
                   1191: 
                   1192:    These instructions assume /your/phpsrcdir/ is the path to the PHP
                   1193:    source distribution, and that extname is the name of the PECL
                   1194:    extension. Adjust accordingly. These instructions also assume a
                   1195:    familiarity with the pear command. The information in the PEAR manual
                   1196:    for the pear command also applies to the pecl command.
                   1197: 
                   1198:    To be useful, a shared extension must be built, installed, and loaded.
                   1199:    The methods described below provide you with various instructions on
                   1200:    how to build and install the extensions, but they do not automatically
                   1201:    load them. Extensions can be loaded by adding an extension directive.
                   1202:    To this php.ini file, or through the use of the dl() function.
                   1203: 
                   1204:    When building PHP modules, it's important to have known-good versions
                   1205:    of the required tools (autoconf, automake, libtool, etc.) See the
                   1206:    SVN Instructions for details on the required tools, and required 
                   1207:    versions.
                   1208:      __________________________________________________________________
                   1209: 
                   1210: Downloading PECL extensions
                   1211: 
                   1212:    There are several options for downloading PECL extensions, such as:
                   1213: 
                   1214:      * http://pecl.php.net
                   1215:        The PECL web site contains information about the different
                   1216:        extensions that are offered by the PHP Development Team. The
                   1217:        information available here includes: ChangeLog, release notes,
                   1218:        requirements and other similar details.
                   1219:      * pecl download extname
                   1220:        PECL extensions that have releases listed on the PECL web site are
                   1221:        available for download and installation using the pecl command.
                   1222:        Specific revisions may also be specified.
                   1223:      * SVN 
                   1224:        Most PECL extensions also reside in SVN. A web-based view may be
                   1225:        seen at http://svn.php.net/pecl/. To download straight from SVN,
                   1226:        the following sequence of commands may be used. 
                   1227: 
                   1228: $ svn  co http://svn.php.net/repository/pecl/<extname>/trunk
                   1229: 
                   1230:      * Windows downloads
                   1231:        Windows users may find compiled PECL binaries by downloading the
                   1232:        Collection of PECL modules from the PHP Downloads page, or by
                   1233:        retrieving a PECL Snapshot or an extension DLL on PECL4WIN. To
                   1234:        compile PHP under Windows, read the appropriate chapter.
                   1235:      __________________________________________________________________
                   1236: 
                   1237: PECL for Windows users
                   1238: 
                   1239:    As with any other PHP extension DLL, installation is as simple as
                   1240:    copying the PECL extension DLLs into the extension_dir folder and
                   1241:    loading them from php.ini. For example, add the following line to your
                   1242:    php.ini:
                   1243: 
                   1244:    extension=php_extname.dll
                   1245: 
                   1246:    After doing this, restart the web server.
                   1247:      __________________________________________________________________
                   1248: 
                   1249: Compiling shared PECL extensions with the pecl command
                   1250: 
                   1251:    PECL makes it easy to create shared PHP extensions. Using the pecl
                   1252:    command, do the following:
                   1253: 
                   1254:    $ pecl install extname
                   1255: 
                   1256:    This will download the source for extname, compile, and install
                   1257:    extname.so into your extension_dir. extname.so may then be loaded via
                   1258:    php.ini
                   1259: 
                   1260:    By default, the pecl command will not install packages that are marked
                   1261:    with the alpha or beta state. If no stable packages are available, you
                   1262:    may install a beta package using the following command:
                   1263: 
                   1264:    $ pecl install extname-beta
                   1265: 
                   1266:    You may also install a specific version using this variant:
                   1267: 
                   1268:    $ pecl install extname-0.1
                   1269:      __________________________________________________________________
                   1270: 
                   1271: Compiling shared PECL extensions with phpize
                   1272: 
                   1273:    Sometimes, using the pecl installer is not an option. This could be
                   1274:    because you're behind a firewall, or it could be because the extension
                   1275:    you want to install is not available as a PECL compatible package, such
                   1276:    as unreleased extensions from SVN. If you need to build such an
                   1277:    extension, you can use the lower-level build tools to perform the build
                   1278:    manually.
                   1279: 
                   1280:    The phpize command is used to prepare the build environment for a PHP
                   1281:    extension. In the following sample, the sources for an extension are in
                   1282:    a directory named extname:
                   1283: 
                   1284: $ cd extname
                   1285: $ phpize
                   1286: $ ./configure
                   1287: $ make
                   1288: # make install
                   1289: 
                   1290:    A successful install will have created extname.so and put it into the
                   1291:    PHP extensions directory. You'll need to and adjust php.ini and add an
                   1292:    extension=extname.so line before you can use the extension.
                   1293: 
                   1294:    If the system is missing the phpize command, and precompiled packages
                   1295:    (like RPM's) are used, be sure to also install the appropriate devel
                   1296:    version of the PHP package as they often include the phpize command
                   1297:    along with the appropriate header files to build PHP and its
                   1298:    extensions.
                   1299: 
                   1300:    Execute phpize --help to display additional usage information.
                   1301:      __________________________________________________________________
                   1302: 
                   1303: Compiling PECL extensions statically into PHP
                   1304: 
                   1305:    You might find that you need to build a PECL extension statically into
                   1306:    your PHP binary. To do this, you'll need to place the extension source
                   1307:    under the php-src/ext/ directory and tell the PHP build system to
                   1308:    regenerate its configure script.
                   1309: 
                   1310: $ cd /your/phpsrcdir/ext
                   1311: $ pecl download extname
                   1312: $ gzip -d < extname.tgz | tar -xvf -
                   1313: $ mv extname-x.x.x extname
                   1314: 
                   1315:    This will result in the following directory:
                   1316: 
                   1317:    /your/phpsrcdir/ext/extname
                   1318: 
                   1319:    From here, force PHP to rebuild the configure script, and then build
                   1320:    PHP as normal:
                   1321: 
                   1322: $ cd /your/phpsrcdir
                   1323: $ rm configure
                   1324: $ ./buildconf --force
                   1325: $ ./configure --help
                   1326: $ ./configure --with-extname --enable-someotherext --with-foobar
                   1327: $ make
                   1328: $ make install
                   1329: 
                   1330:      Note: To run the 'buildconf' script you need autoconf 2.13 and
                   1331:      automake 1.4+ (newer versions of autoconf may work, but are not
                   1332:      supported).
                   1333: 
                   1334:    Whether --enable-extname or --with-extname is used depends on the
                   1335:    extension. Typically an extension that does not require external
                   1336:    libraries uses --enable. To be sure, run the following after buildconf:
                   1337: 
                   1338:    $ ./configure --help | grep extname
                   1339:      __________________________________________________________________
                   1340: 
                   1341: Chapter 4. Problems?
                   1342: 
                   1343: Read the FAQ
                   1344: 
                   1345:    Some problems are more common than others. The most common ones are
                   1346:    listed in the PHP FAQ, part of this manual.
                   1347:      __________________________________________________________________
                   1348: 
                   1349: Other problems
                   1350: 
                   1351:    If you are still stuck, someone on the PHP installation mailing list
                   1352:    may be able to help you. You should check out the archive first, in
                   1353:    case someone already answered someone else who had the same problem as
                   1354:    you. The archives are available from the support page on
                   1355:    http://www.php.net/support.php. To subscribe to the PHP installation
                   1356:    mailing list, send an empty mail to
                   1357:    php-install-subscribe@lists.php.net. The mailing list address is
                   1358:    php-install@lists.php.net.
                   1359: 
                   1360:    If you want to get help on the mailing list, please try to be precise
                   1361:    and give the necessary details about your environment (which operating
                   1362:    system, what PHP version, what web server, if you are running PHP as
                   1363:    CGI or a server module, safe mode, etc...), and preferably enough code
                   1364:    to make others able to reproduce and test your problem.
                   1365:      __________________________________________________________________
                   1366: 
                   1367: Bug reports
                   1368: 
                   1369:    If you think you have found a bug in PHP, please report it. The PHP
                   1370:    developers probably don't know about it, and unless you report it,
                   1371:    chances are it won't be fixed. You can report bugs using the
                   1372:    bug-tracking system at http://bugs.php.net/. Please do not send bug
                   1373:    reports in mailing list or personal letters. The bug system is also
                   1374:    suitable to submit feature requests.
                   1375: 
                   1376:    Read the How to report a bug document before submitting any bug
                   1377:    reports!
                   1378:      __________________________________________________________________
                   1379: 
                   1380: Chapter 5. Runtime Configuration
                   1381: 
                   1382: The configuration file
                   1383: 
                   1384:    The configuration file (called php3.ini in PHP 3, and simply php.ini as
                   1385:    of PHP 4) is read when PHP starts up. For the server module versions of
                   1386:    PHP, this happens only once when the web server is started. For the CGI
                   1387:    and CLI version, it happens on every invocation.
                   1388: 
                   1389:    php.ini is searched in these locations (in order):
                   1390: 
                   1391:      * SAPI module specific location (PHPIniDir directive in Apache 2, -c
                   1392:        command line option in CGI and CLI, php_ini parameter in NSAPI,
                   1393:        PHP_INI_PATH environment variable in THTTPD)
                   1394:      * The PHPRC environment variable. Before PHP 5.2.0 this was checked
                   1395:        after the registry key mentioned below.
                   1396:      * As of PHP 5.2.0, the following registry locations are searched in
                   1397:        order: HKEY_LOCAL_MACHINE\SOFTWARE\PHP\x.y.z\IniFilePath,
                   1398:        HKEY_LOCAL_MACHINE\SOFTWARE\PHP\x.y\IniFilePath and
                   1399:        HKEY_LOCAL_MACHINE\SOFTWARE\PHP\x\IniFilePath, where x, y and z
                   1400:        mean the PHP major, minor and release versions.
                   1401:      * HKEY_LOCAL_MACHINE\SOFTWARE\PHP\IniFilePath (Windows Registry
                   1402:        location)
                   1403:      * Current working directory (except CLI)
                   1404:      * The web server's directory (for SAPI modules), or directory of PHP
                   1405:        (otherwise in Windows)
                   1406:      * Windows directory (C:\windows or C:\winnt) (for Windows), or
                   1407:        --with-config-file-path compile time option
                   1408: 
                   1409:    If php-SAPI.ini exists (where SAPI is used SAPI, so the filename is
                   1410:    e.g. php-cli.ini or php-apache.ini), it's used instead of php.ini. SAPI
                   1411:    name can be determined by php_sapi_name().
                   1412: 
                   1413:      Note: The Apache web server changes the directory to root at startup
                   1414:      causing PHP to attempt to read php.ini from the root filesystem if
                   1415:      it exists.
                   1416: 
                   1417:    The php.ini directives handled by extensions are documented
                   1418:    respectively on the pages of the extensions themselves. The list of the
                   1419:    core directives is available in the appendix. Probably not all PHP
                   1420:    directives are documented in the manual though. For a complete list of
                   1421:    directives available in your PHP version, please read your well
                   1422:    commented php.ini file. Alternatively, you may find the latest
                   1423:    php.ini from SVN helpful too.
                   1424: 
                   1425:    Example 5-1. php.ini example
                   1426: ; any text on a line after an unquoted semicolon (;) is ignored
                   1427: [php] ; section markers (text within square brackets) are also ignored
                   1428: ; Boolean values can be set to either:
                   1429: ;    true, on, yes
                   1430: ; or false, off, no, none
1.1.1.2 ! misho    1431: html_errors = off
1.1       misho    1432: track_errors = yes
                   1433: 
                   1434: ; you can enclose strings in double-quotes
                   1435: include_path = ".:/usr/local/lib/php"
                   1436: 
                   1437: ; backslashes are treated the same as any other character
                   1438: include_path = ".;c:\php\lib"
                   1439: 
                   1440:    Since PHP 5.1.0, it is possible to refer to existing .ini variables
                   1441:    from within .ini files. Example: open_basedir = ${open_basedir}
                   1442:    ":/new/dir".
                   1443:      __________________________________________________________________
                   1444: 
                   1445: How to change configuration settings
                   1446: 
                   1447: Running PHP as an Apache module
                   1448: 
                   1449:    When using PHP as an Apache module, you can also change the
                   1450:    configuration settings using directives in Apache configuration files
                   1451:    (e.g. httpd.conf) and .htaccess files. You will need "AllowOverride
                   1452:    Options" or "AllowOverride All" privileges to do so.
                   1453: 
                   1454:    With PHP 4 and PHP 5, there are several Apache directives that allow
                   1455:    you to change the PHP configuration from within the Apache
                   1456:    configuration files. For a listing of which directives are PHP_INI_ALL,
                   1457:    PHP_INI_PERDIR, or PHP_INI_SYSTEM, have a look at the List of php.ini
                   1458:    directives appendix.
                   1459: 
                   1460:      Note: With PHP 3, there are Apache directives that correspond to
                   1461:      each configuration setting in the php3.ini name, except the name is
                   1462:      prefixed by "php3_".
                   1463: 
                   1464:    php_value name value
                   1465:           Sets the value of the specified directive. Can be used only with
                   1466:           PHP_INI_ALL and PHP_INI_PERDIR type directives. To clear a
                   1467:           previously set value use none as the value.
                   1468: 
                   1469:      Note: Don't use php_value to set boolean values. php_flag (see
                   1470:      below) should be used instead.
                   1471: 
                   1472:    php_flag name on|off
                   1473:           Used to set a boolean configuration directive. Can be used only
                   1474:           with PHP_INI_ALL and PHP_INI_PERDIR type directives.
                   1475: 
                   1476:    php_admin_value name value
                   1477:           Sets the value of the specified directive. This can not be used
                   1478:           in .htaccess files. Any directive type set with php_admin_value
                   1479:           can not be overridden by .htaccess or virtualhost directives. To
                   1480:           clear a previously set value use none as the value.
                   1481: 
                   1482:    php_admin_flag name on|off
                   1483:           Used to set a boolean configuration directive. This can not be
                   1484:           used in .htaccess files. Any directive type set with
                   1485:           php_admin_flag can not be overridden by .htaccess or virtualhost
                   1486:           directives.
                   1487: 
                   1488:    Example 5-2. Apache configuration example
                   1489: <IfModule mod_php5.c>
                   1490:   php_value include_path ".:/usr/local/lib/php"
1.1.1.2 ! misho    1491:   php_admin_flag engine on
1.1       misho    1492: </IfModule>
                   1493: 
                   1494:    Caution
                   1495: 
                   1496:    PHP constants do not exist outside of PHP. For example, in httpd.conf
                   1497:    you can not use PHP constants such as E_ALL or E_NOTICE to set the
                   1498:    error_reporting directive as they will have no meaning and will
                   1499:    evaluate to 0. Use the associated bitmask values instead. These
                   1500:    constants can be used in php.ini
                   1501:      __________________________________________________________________
                   1502: 
                   1503: Changing PHP configuration via the Windows registry
                   1504: 
                   1505:    When running PHP on Windows, the configuration values can be modified
                   1506:    on a per-directory basis using the Windows registry. The configuration
                   1507:    values are stored in the registry key HKLM\SOFTWARE\PHP\Per Directory
                   1508:    Values, in the sub-keys corresponding to the path names. For example,
                   1509:    configuration values for the directory c:\inetpub\wwwroot would be
                   1510:    stored in the key HKLM\SOFTWARE\PHP\Per Directory
                   1511:    Values\c\inetpub\wwwroot. The settings for the directory would be
                   1512:    active for any script running from this directory or any subdirectory
                   1513:    of it. The values under the key should have the name of the PHP
                   1514:    configuration directive and the string value. PHP constants in the
                   1515:    values are not parsed. However, only configuration values changeable in
                   1516:    PHP_INI_USER can be set this way, PHP_INI_PERDIR values can not.
                   1517:      __________________________________________________________________
                   1518: 
                   1519: Other interfaces to PHP
                   1520: 
                   1521:    Regardless of how you run PHP, you can change certain values at runtime
                   1522:    of your scripts through ini_set(). See the documentation on the
                   1523:    ini_set() page for more information.
                   1524: 
                   1525:    If you are interested in a complete list of configuration settings on
                   1526:    your system with their current values, you can execute the phpinfo()
                   1527:    function, and review the resulting page. You can also access the values
                   1528:    of individual configuration directives at runtime using ini_get() or
                   1529:    get_cfg_var().
                   1530:      __________________________________________________________________
                   1531: 
                   1532: Chapter 6. Installation FAQ
                   1533: 
                   1534:    This section holds common questions about the way to install PHP. PHP
                   1535:    is available for almost any OS (except maybe for MacOS before OSX), and
                   1536:    almost any web server.
                   1537: 
                   1538:    To install PHP, follow the instructions in Installing PHP.
                   1539: 
                   1540:    1. Why shouldn't I use Apache2 with a threaded MPM in a production
                   1541:           environment?
                   1542: 
                   1543:    2. Unix/Windows: Where should my php.ini file be located?
                   1544:    3. Unix: I installed PHP, but every time I load a document, I get the
                   1545:           message 'Document Contains No Data'! What's going on here?
                   1546: 
                   1547:    4. Unix: I installed PHP using RPMS, but Apache isn't processing the
                   1548:           PHP pages! What's going on here?
                   1549: 
                   1550:    5. Unix: I installed PHP 3 using RPMS, but it doesn't compile with the
                   1551:           database support I need! What's going on here?
                   1552: 
                   1553:    6. Unix: I patched Apache with the FrontPage extensions patch, and
                   1554:           suddenly PHP stopped working. Is PHP incompatible with the
                   1555:           Apache FrontPage extensions?
                   1556: 
                   1557:    7. Unix/Windows: I have installed PHP, but when I try to access a PHP
                   1558:           script file via my browser, I get a blank screen.
                   1559: 
                   1560:    8. Unix/Windows: I have installed PHP, but when try to access a PHP
                   1561:           script file via my browser, I get a server 500 error.
                   1562: 
                   1563:    9. Some operating systems: I have installed PHP without errors, but
                   1564:           when I try to start apache I get undefined symbol errors:
                   1565: 
                   1566: [mybox:user /src/php5] root# apachectl configtest
                   1567:  apachectl: /usr/local/apache/bin/httpd Undefined symbols:
                   1568:   _compress
                   1569:   _uncompress
                   1570: 
                   1571:    10. Windows: I have installed PHP, but when I to access a PHP script
                   1572:           file via my browser, I get the error:
                   1573: 
                   1574: cgi error:
                   1575:  The specified CGI application misbehaved by not
                   1576:  returning a complete set of HTTP headers.
                   1577:  The headers it did return are:
                   1578: 
                   1579:    11. Windows: I've followed all the instructions, but still can't get
                   1580:           PHP and IIS to work together!
                   1581: 
                   1582:    12. When running PHP as CGI with IIS, PWS, OmniHTTPD or Xitami, I get
                   1583:           the following error: Security Alert! PHP CGI cannot be accessed
                   1584:           directly..
                   1585: 
                   1586:    13. How do I know if my php.ini is being found and read? It seems like
                   1587:           it isn't as my changes aren't being implemented.
                   1588: 
                   1589:    14. How do I add my PHP directory to the PATH on Windows?
                   1590:    15. How do I make the php.ini file available to PHP on windows?
                   1591:    16. Is it possible to use Apache content negotiation (MultiViews
                   1592:           option) with PHP?
                   1593: 
                   1594:    17. Is PHP limited to process GET and POST request methods only?
                   1595: 
                   1596:    1. Why shouldn't I use Apache2 with a threaded MPM in a production
                   1597:    environment?
                   1598: 
                   1599:    PHP is glue. It is the glue used to build cool web applications by
                   1600:    sticking dozens of 3rd-party libraries together and making it all
                   1601:    appear as one coherent entity through an intuitive and easy to learn
                   1602:    language interface. The flexibility and power of PHP relies on the
                   1603:    stability and robustness of the underlying platform. It needs a working
                   1604:    OS, a working web server and working 3rd-party libraries to glue
                   1605:    together. When any of these stop working PHP needs ways to identify the
                   1606:    problems and fix them quickly. When you make the underlying framework
                   1607:    more complex by not having completely separate execution threads,
                   1608:    completely separate memory segments and a strong sandbox for each
                   1609:    request to play in, feet of clay are introduced into PHP's system.
                   1610: 
                   1611:    If you feel you have to use a threaded MPM, look at a FastCGI
                   1612:    configuration where PHP is running in its own memory space.
                   1613: 
                   1614:    And finally, this warning against using a threaded MPM is not as strong
                   1615:    for Windows systems because most libraries on that platform tend to be
                   1616:    threadsafe.
                   1617: 
                   1618:    2. Unix/Windows: Where should my php.ini file be located?
                   1619: 
                   1620:    By default on Unix it should be in /usr/local/lib which is
                   1621:    <install-path>/lib. Most people will want to change this at
                   1622:    compile-time with the --with-config-file-path flag. You would, for
                   1623:    example, set it with something like:
                   1624:    --with-config-file-path=/etc
                   1625: 
                   1626:    And then you would copy php.ini-production from the distribution to
                   1627:    /etc/php.ini and edit it to make any local changes you want.
                   1628:    --with-config-file-scan-dir=PATH
                   1629: 
                   1630:    On Windows the default path for the php.ini file is the Windows
                   1631:    directory. If you're using the Apache webserver, php.ini is first
                   1632:    searched in the Apaches install directory, e.g. c:\program files\apache
                   1633:    group\apache. This way you can have different php.ini files for
                   1634:    different versions of Apache on the same machine.
                   1635: 
                   1636:    See also the chapter about the configuration file.
                   1637: 
                   1638:    3. Unix: I installed PHP, but every time I load a document, I get the
                   1639:    message 'Document Contains No Data'! What's going on here?
                   1640: 
                   1641:    This probably means that PHP is having some sort of problem and is
                   1642:    core-dumping. Look in your server error log to see if this is the case,
                   1643:    and then try to reproduce the problem with a small test case. If you
                   1644:    know how to use 'gdb', it is very helpful when you can provide a
                   1645:    backtrace with your bug report to help the developers pinpoint the
                   1646:    problem. If you are using PHP as an Apache module try something like:
                   1647: 
                   1648:      * Stop your httpd processes
                   1649:      * gdb httpd
                   1650:      * Stop your httpd processes
                   1651:      * > run -X -f /path/to/httpd.conf
                   1652:      * Then fetch the URL causing the problem with your browser
                   1653:      * > run -X -f /path/to/httpd.conf
                   1654:      * If you are getting a core dump, gdb should inform you of this now
                   1655:      * type: bt
                   1656:      * You should include your backtrace in your bug report. This should
                   1657:        be submitted to http://bugs.php.net/
                   1658: 
                   1659:    If your script uses the regular expression functions (ereg() and
                   1660:    friends), you should make sure that you compiled PHP and Apache with
                   1661:    the same regular expression package. This should happen automatically
                   1662:    with PHP and Apache 1.3.x
                   1663: 
                   1664:    4. Unix: I installed PHP using RPMS, but Apache isn't processing the
                   1665:    PHP pages! What's going on here?
                   1666: 
                   1667:    Assuming you installed both Apache and PHP from RPM packages, you need
                   1668:    to uncomment or add some or all of the following lines in your
                   1669:    httpd.conf file:
                   1670: # Extra Modules
                   1671: AddModule mod_php.c
                   1672: AddModule mod_php3.c
                   1673: AddModule mod_perl.c
                   1674: 
                   1675: # Extra Modules
                   1676: LoadModule php_module         modules/mod_php.so
                   1677: LoadModule perl_module        modules/libperl.so
                   1678: 
                   1679:    And add:
                   1680: AddType application/x-httpd-php3 .php3    # for PHP 3
                   1681: AddType application/x-httpd-php .php      # for PHP 4
                   1682: 
                   1683:    ... to the global properties, or to the properties of the VirtualDomain
                   1684:    you want to have PHP support added to.
                   1685: 
                   1686:    5. Unix: I installed PHP 3 using RPMS, but it doesn't compile with the
                   1687:    database support I need! What's going on here?
                   1688: 
                   1689:    Due to the way PHP 3 built, it is not easy to build a complete flexible
                   1690:    PHP RPM. This issue is addressed in PHP 4. For PHP 3, we currently
                   1691:    suggest you use the mechanism described in the INSTALL.REDHAT file in
                   1692:    the PHP distribution. If you insist on using an RPM version of PHP 3,
                   1693:    read on...
                   1694: 
                   1695:    The RPM packagers are setting up the RPMS to install without database
                   1696:    support to simplify installations and because RPMS use /usr/ instead of
                   1697:    the standard /usr/local/ directory for files. You need to tell the RPM
                   1698:    spec file which databases to support and the location of the top-level
                   1699:    of your database server.
                   1700: 
                   1701:    This example will explain the process of adding support for the popular
                   1702:    MySQL database server, using the mod installation for Apache.
                   1703: 
                   1704:    Of course all of this information can be adjusted for any database
                   1705:    server that PHP supports. We will assume you installed MySQL and Apache
                   1706:    completely with RPMS for this example as well.
                   1707: 
                   1708:      * First remove mod_php3 :
                   1709: 
                   1710: rpm -e mod_php3
                   1711: 
                   1712:      * Then get the source rpm and INSTALL it, NOT --rebuild
                   1713: 
                   1714: rpm -Uvh mod_php3-3.0.5-2.src.rpm
                   1715: 
                   1716:      * Then edit the /usr/src/redhat/SPECS/mod_php3.spec file
                   1717:        In the %build section add the database support you want, and the
                   1718:        path.
                   1719:        For MySQL you would add --with-mysql=/usr The %build section will
                   1720:        look something like this:
                   1721: 
                   1722: ./configure --prefix=/usr \
                   1723: --with-apxs=/usr/sbin/apxs \
                   1724: --with-config-file-path=/usr/lib \
                   1725: --enable-debug=no \
                   1726: --enable-safe-mode \
                   1727: --with-exec-dir=/usr/bin \
                   1728: --with-mysql=/usr \
                   1729: --with-system-regex
                   1730: 
                   1731:      * Once this modification is made then build the binary rpm as
                   1732:        follows:
                   1733: 
                   1734: rpm -bb /usr/src/redhat/SPECS/mod_php3.spec
                   1735: 
                   1736:      * Then install the rpm
                   1737: 
                   1738: rpm -ivh /usr/src/redhat/RPMS/i386/mod_php3-3.0.5-2.i386.rpm
                   1739: 
                   1740:    Make sure you restart Apache, and you now have PHP 3 with MySQL support
                   1741:    using RPM's. Note that it is probably much easier to just build from
                   1742:    the distribution tarball of PHP 3 and follow the instructions in
                   1743:    INSTALL.REDHAT found in that distribution.
                   1744: 
                   1745:    6. Unix: I patched Apache with the FrontPage extensions patch, and
                   1746:    suddenly PHP stopped working. Is PHP incompatible with the Apache
                   1747:    FrontPage extensions?
                   1748: 
                   1749:    No, PHP works fine with the FrontPage extensions. The problem is that
                   1750:    the FrontPage patch modifies several Apache structures, that PHP relies
                   1751:    on. Recompiling PHP (using 'make clean ; make') after the FP patch is
                   1752:    applied would solve the problem.
                   1753: 
                   1754:    7. Unix/Windows: I have installed PHP, but when I try to access a PHP
                   1755:    script file via my browser, I get a blank screen.
                   1756: 
                   1757:    Do a 'view source' in the web browser and you will probably find that
                   1758:    you can see the source code of your PHP script. This means that the web
                   1759:    server did not send the script to PHP for interpretation. Something is
                   1760:    wrong with the server configuration - double check the server
                   1761:    configuration against the PHP installation instructions.
                   1762: 
                   1763:    8. Unix/Windows: I have installed PHP, but when try to access a PHP
                   1764:    script file via my browser, I get a server 500 error.
                   1765: 
                   1766:    Something went wrong when the server tried to run PHP. To get to see a
                   1767:    sensible error message, from the command line, change to the directory
                   1768:    containing the PHP executable (php.exe on Windows) and run php -i. If
                   1769:    PHP has any problems running, then a suitable error message will be
                   1770:    displayed which will give you a clue as to what needs to be done next.
                   1771:    If you get a screen full of HTML codes (the output of the phpinfo()
                   1772:    function) then PHP is working, and your problem may be related to your
                   1773:    server configuration which you should double check.
                   1774: 
                   1775:    9. Some operating systems: I have installed PHP without errors, but
                   1776:    when I try to start apache I get undefined symbol errors:
                   1777: [mybox:user /src/php5] root# apachectl configtest
                   1778:  apachectl: /usr/local/apache/bin/httpd Undefined symbols:
                   1779:   _compress
                   1780:   _uncompress
                   1781: 
                   1782:    This has actually nothing to do with PHP, but with the MySQL client
                   1783:    libraries. Some need --with-zlib, others do not. This is also covered
                   1784:    in the MySQL FAQ.
                   1785: 
                   1786:    10. Windows: I have installed PHP, but when I to access a PHP script
                   1787:    file via my browser, I get the error:
                   1788: cgi error:
                   1789:  The specified CGI application misbehaved by not
                   1790:  returning a complete set of HTTP headers.
                   1791:  The headers it did return are:
                   1792: 
                   1793:    This error message means that PHP failed to output anything at all. To
                   1794:    get to see a sensible error message, from the command line, change to
                   1795:    the directory containing the PHP executable (php.exe on Windows) and
                   1796:    run php -i. If PHP has any problems running, then a suitable error
                   1797:    message will be displayed which will give you a clue as to what needs
                   1798:    to be done next. If you get a screen full of HTML codes (the output of
                   1799:    the phpinfo() function) then PHP is working.
                   1800: 
                   1801:    Once PHP is working at the command line, try accessing the script via
                   1802:    the browser again. If it still fails then it could be one of the
                   1803:    following:
                   1804: 
                   1805:      * File permissions on your PHP script, php.exe, php5ts.dll, php.ini
                   1806:        or any PHP extensions you are trying to load are such that the
                   1807:        anonymous internet user ISUR_<machinename> cannot access them.
                   1808:      * The script file does not exist (or possibly isn't where you think
                   1809:        it is relative to your web root directory). Note that for IIS you
                   1810:        can trap this error by ticking the 'check file exists' box when
                   1811:        setting up the script mappings in the Internet Services Manager. If
                   1812:        a script file does not exist then the server will return a 404
                   1813:        error instead. There is also the additional benefit that IIS will
                   1814:        do any authentication required for you based on the NTLanMan
                   1815:        permissions on your script file.
                   1816: 
                   1817:    11. Windows: I've followed all the instructions, but still can't get
                   1818:    PHP and IIS to work together!
                   1819: 
                   1820:    Make sure any user who needs to run a PHP script has the rights to run
                   1821:    php.exe! IIS uses an anonymous user which is added at the time IIS is
                   1822:    installed. This user needs rights to php.exe. Also, any authenticated
                   1823:    user will also need rights to execute php.exe. And for IIS4 you need to
                   1824:    tell it that PHP is a script engine. Also, you will want to read this
                   1825:    faq.
                   1826: 
                   1827:    12. When running PHP as CGI with IIS, PWS, OmniHTTPD or Xitami, I get
                   1828:    the following error: Security Alert! PHP CGI cannot be accessed
                   1829:    directly..
                   1830: 
                   1831:    You must set the cgi.force_redirect directive to 0. It defaults to 1 so
                   1832:    be sure the directive isn't commented out (with a ;). Like all
                   1833:    directives, this is set in php.ini
                   1834: 
                   1835:    Because the default is 1, it's critical that you're 100% sure that the
                   1836:    correct php.ini file is being read. Read this faq for details.
                   1837: 
                   1838:    13. How do I know if my php.ini is being found and read? It seems like
                   1839:    it isn't as my changes aren't being implemented.
                   1840: 
                   1841:    To be sure your php.ini is being read by PHP, make a call to phpinfo()
                   1842:    and near the top will be a listing called Configuration File (php.ini).
                   1843:    This will tell you where PHP is looking for php.ini and whether or not
                   1844:    it's being read. If just a directory PATH exists than it's not being
                   1845:    read and you should put your php.ini in that directory. If php.ini is
                   1846:    included within the PATH than it is being read.
                   1847: 
                   1848:    If php.ini is being read and you're running PHP as a module, then be
                   1849:    sure to restart your web server after making changes to php.ini
                   1850: 
                   1851:    14. How do I add my PHP directory to the PATH on Windows?
                   1852: 
                   1853:    On Windows NT, 2000, XP and 2003:
                   1854: 
                   1855:      * Go to Control Panel and open the System icon (Start -> Settings ->
                   1856:        Control Panel -> System, or just Start -> Control Panel -> System
                   1857:        for Windows XP/2003)
                   1858:      * Go to the Advanced tab
                   1859:      * Click on the 'Environment Variables' button
                   1860:      * Look into the 'System Variables' pane
                   1861:      * Find the Path entry (you may need to scroll to find it)
                   1862:      * Double click on the Path entry
                   1863:      * Enter your PHP directory at the end, including ';' before (e.g.
                   1864:        ;C:\php)
                   1865:      * Press OK and restart your computer
                   1866: 
                   1867:    On Windows 98/Me you need to edit the autoexec.bat file:
                   1868: 
                   1869:      * Open the Notepad (Start -> Run and enter notepad)
                   1870:      * Open the C:\autoexec.bat file
                   1871:      * Locate the line with PATH=C:\WINDOWS;C:\WINDOWS\COMMAND;..... and
                   1872:        add: ;C:\php to the end of the line
                   1873:      * Save the file and restart your computer
                   1874: 
                   1875:      Note: Be sure to reboot after following the steps above to ensure
                   1876:      that the PATH changes are applied.
                   1877: 
                   1878:    The PHP manual used to promote the copying of files into the Windows
                   1879:    system directory, this is because this directory (C:\Windows, C:\WINNT,
                   1880:    etc.) is by default in the systems PATH. Copying files into the Windows
                   1881:    system directory has long since been deprecated and may cause problems.
                   1882: 
                   1883:    15. How do I make the php.ini file available to PHP on windows?
                   1884: 
                   1885:    There are several ways of doing this. If you are using Apache, read
                   1886:    their installation specific instructions (Apache 1, Apache 2),
                   1887:    otherwise you must set the PHPRC environment variable:
                   1888: 
                   1889:    On Windows NT, 2000, XP and 2003:
                   1890: 
                   1891:      * Go to Control Panel and open the System icon (Start -> Settings ->
                   1892:        Control Panel -> System, or just Start -> Control Panel -> System
                   1893:        for Windows XP/2003)
                   1894:      * Go to the Advanced tab
                   1895:      * Click on the 'Environment Variables' button
                   1896:      * Look into the 'System variables' pane
                   1897:      * Click on 'New' and enter 'PHPRC' as the variable name and the
                   1898:        directory where php.ini is located as the variable value (e.g.
                   1899:        C:\php)
                   1900:      * Press OK and restart your computer
                   1901: 
                   1902:    On Windows 98/Me you need to edit the autoexec.bat file:
                   1903: 
                   1904:      * Open the Notepad (Start -> Run and enter notepad)
                   1905:      * Open the C:\autoexec.bat file
                   1906:      * Add a new line to the end of the file: set PHPRC=C:\php (replace
                   1907:        C:\php with the directory where php.ini is located). Please note
                   1908:        that the path cannot contain spaces. For instance, if you have
                   1909:        installed PHP in C:\Program Files\PHP, you would enter
                   1910:        C:\PROGRA~1\PHP instead.
                   1911:      * Save the file and restart your computer
                   1912: 
                   1913:    16. Is it possible to use Apache content negotiation (MultiViews
                   1914:    option) with PHP?
                   1915: 
                   1916:    If links to PHP files include extension, everything works perfect. This
                   1917:    FAQ is only for the case when links to PHP files don't include
                   1918:    extension and you want to use content negotiation to choose PHP files
                   1919:    from URL with no extension. In this case, replace the line AddType
                   1920:    application/x-httpd-php .php with:
                   1921: # PHP 4
                   1922: AddHandler php-script php
                   1923: AddType text/html php
                   1924: 
                   1925: # PHP 5
                   1926: AddHandler php5-script php
                   1927: AddType text/html php
                   1928: 
                   1929:    This solution doesn't work for Apache 1 as PHP module doesn't catch
                   1930:    php-script.
                   1931: 
                   1932:    17. Is PHP limited to process GET and POST request methods only?
                   1933: 
                   1934:    No, it is possible to handle any request method, e.g. CONNECT. Proper
                   1935:    response status can be sent with header(). If only GET and POST methods
                   1936:    should be handled, it can be achieved with this Apache configuration:
                   1937: <LimitExcept GET POST>
                   1938: Deny from all
                   1939: </LimitExcept>

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>