Annotation of embedaddon/php/win32/install.txt, revision 1.1
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: Simply change your scripts to get CGI variables in the correct way for
! 952: PHP 5.x by using the superglobal $_SERVER. If you have older scripts
! 953: which use $HTTP_HOST, etc., you should turn on register_globals in
! 954: php.ini and change the variable order too (important: remove "E" from
! 955: it, because you do not need the environment here):
! 956: variables_order = "GPCS"
! 957: register_globals = On
! 958: __________________________________________________________________
! 959:
! 960: Special use for error pages or self-made directory listings (PHP >= 4.3.3)
! 961:
! 962: You can use PHP to generate the error pages for "404 Not Found" or
! 963: similar. Add the following line to the object in obj.conf for every
! 964: error page you want to overwrite:
! 965: Error fn="php5_execute" code=XXX script="/path/to/script.php" [inikey=value inik
! 966: ey=value...]
! 967:
! 968: where XXX is the HTTP error code. Please delete any other Error
! 969: directives which could interfere with yours. If you want to place a
! 970: page for all errors that could exist, leave the code parameter out.
! 971: Your script can get the HTTP status code with $_SERVER['ERROR_TYPE'].
! 972:
! 973: Another possibility is to generate self-made directory listings. Just
! 974: create a PHP script which displays a directory listing and replace the
! 975: corresponding default Service line for type="magnus-internal/directory"
! 976: in obj.conf with the following:
! 977: Service fn="php5_execute" type="magnus-internal/directory" script="/path/to/scri
! 978: pt.php" [inikey=value inikey=value...]
! 979:
! 980: For both error and directory listing pages the original URI and
! 981: translated URI are in the variables $_SERVER['PATH_INFO'] and
! 982: $_SERVER['PATH_TRANSLATED'].
! 983: __________________________________________________________________
! 984:
! 985: Note about nsapi_virtual() and subrequests (PHP >= 4.3.3)
! 986:
! 987: The NSAPI module now supports the nsapi_virtual() function (alias:
! 988: virtual()) to make subrequests on the web server and insert the result
! 989: in the web page. The problem is, that this function uses some
! 990: undocumented features from the NSAPI library.
! 991:
! 992: Under Unix this is not a problem, because the module automatically
! 993: looks for the needed functions and uses them if available. If not,
! 994: nsapi_virtual() is disabled.
! 995:
! 996: Under Windows limitations in the DLL handling need the use of a
! 997: automatic detection of the most recent ns-httpdXX.dll file. This is
! 998: tested for servers till version 6.1. If a newer version of the Sun
! 999: server is used, the detection fails and nsapi_virtual() is disabled.
! 1000:
! 1001: If this is the case, try the following: Add the following parameter to
! 1002: php5_init in magnus.conf/obj.conf:
! 1003: Init fn=php5_init ... server_lib="ns-httpdXX.dll"
! 1004:
! 1005: where XX is the correct DLL version number. To get it, look in the
! 1006: server-root for the correct DLL name. The DLL with the biggest filesize
! 1007: is the right one.
! 1008:
! 1009: You can check the status by using the phpinfo() function.
! 1010:
! 1011: Note: But be warned: Support for nsapi_virtual() is EXPERIMENTAL!!!
! 1012: __________________________________________________________________
! 1013:
! 1014: OmniHTTPd Server
! 1015:
! 1016: This section contains notes and hints specific to OmniHTTPd on Windows.
! 1017:
! 1018: Note: You should read the manual installation steps first!
! 1019:
! 1020: Warning
! 1021:
! 1022: By using the CGI setup, your server is open to several possible
! 1023: attacks. Please read our CGI security section to learn how to defend
! 1024: yourself from those attacks.
! 1025:
! 1026: You need to complete the following steps to make PHP work with
! 1027: OmniHTTPd. This is a CGI executable setup. SAPI is supported by
! 1028: OmniHTTPd, but some tests have shown that it is not so stable to use
! 1029: PHP as an ISAPI module.
! 1030:
! 1031: Important for CGI users: Read the faq on cgi.force_redirect for
! 1032: important details. This directive needs to be set to 0.
! 1033:
! 1034: 1. Install OmniHTTPd server.
! 1035: 2. Right click on the blue OmniHTTPd icon in the system tray and
! 1036: select Properties
! 1037: 3. Click on Web Server Global Settings
! 1038: 4. On the 'External' tab, enter: virtual = .php | actual =
! 1039: c:\php\php.exe (use php-cgi.exe if installing PHP 5), and use the
! 1040: Add button.
! 1041: 5. On the Mime tab, enter: virtual = wwwserver/stdcgi | actual = .php,
! 1042: and use the Add button.
! 1043: 6. Click OK
! 1044:
! 1045: Repeat steps 2 - 6 for each extension you want to associate with PHP.
! 1046:
! 1047: __________________________________________________________________
! 1048:
! 1049: Xitami on Microsoft Windows
! 1050:
! 1051: This section contains notes and hints specific to Xitami on Windows.
! 1052:
! 1053: Note: You should read the manual installation steps first!
! 1054:
! 1055: This list describes how to set up the PHP CGI binary to work with
! 1056: Xitami on Windows.
! 1057:
! 1058: Important for CGI users: Read the faq on cgi.force_redirect for
! 1059: important details. This directive needs to be set to 0. If you want
! 1060: to use $_SERVER['PHP_SELF'] you have to enable the cgi.fix_pathinfo
! 1061: directive.
! 1062:
! 1063: Warning
! 1064:
! 1065: By using the CGI setup, your server is open to several possible
! 1066: attacks. Please read our CGI security section to learn how to defend
! 1067: yourself from those attacks.
! 1068:
! 1069: * Make sure the web server is running, and point your browser to
! 1070: xitamis admin console (usually http://127.0.0.1/admin), and click
! 1071: on Configuration.
! 1072: * Navigate to the Filters, and put the extension which PHP should
! 1073: parse (i.e. .php) into the field File extensions (.xxx).
! 1074: * In Filter command or script put the path and name of your PHP CGI
! 1075: executable i.e. C:\php\php-cgi.exe.
! 1076: * Press the 'Save' icon.
! 1077: * Restart the server to reflect changes.
! 1078: __________________________________________________________________
! 1079:
! 1080: Installation of extensions on Windows
! 1081:
! 1082: After installing PHP and a web server on Windows, you will probably
! 1083: want to install some extensions for added functionality. You can choose
! 1084: which extensions you would like to load when PHP starts by modifying
! 1085: your php.ini. You can also load a module dynamically in your script
! 1086: using dl().
! 1087:
! 1088: The DLLs for PHP extensions are prefixed with php_.
! 1089:
! 1090: Many extensions are built into the Windows version of PHP. This means
! 1091: additional DLL files, and the extension directive, are not used to load
! 1092: these extensions. The Windows PHP Extensions table lists extensions
! 1093: that require, or used to require, additional PHP DLL files. Here's a
! 1094: list of built in extensions:
! 1095:
! 1096: In PHP 5 (updated PHP 5.0.4), the following changes exist. Built in:
! 1097: DOM, LibXML, Iconv, SimpleXML, SPL and SQLite. And the following are no
! 1098: longer built in: MySQL and Overload.
! 1099:
! 1100: The default location PHP searches for extensions is C:\php5 in PHP 5.
! 1101: To change this setting to reflect your setup of PHP edit your php.ini
! 1102: file:
! 1103:
! 1104: * You will need to change the extension_dir setting to point to the
! 1105: directory where your extensions lives, or where you have placed
! 1106: your php_*.dll files. For example:
! 1107:
! 1108: extension_dir = C:\php\extensions
! 1109:
! 1110: * Enable the extension(s) in php.ini you want to use by uncommenting
! 1111: the extension=php_*.dll lines in php.ini. This is done by deleting
! 1112: the leading ; from the extension you want to load.
! 1113:
! 1114: Example 2-8. Enable Bzip2 extension for PHP-Windows
! 1115: // change the following line from ...
! 1116: ;extension=php_bz2.dll
! 1117:
! 1118: // ... to
! 1119: extension=php_bz2.dll
! 1120:
! 1121: * Some of the extensions need extra DLLs to work. Couple of them can
! 1122: be found in the distribution package, in in the main folder in PHP 5,
! 1123: but some, for example Oracle (php_oci8.dll) require DLLs which are
! 1124: not bundled with the distribution package.
! 1125: * Some of these DLLs are not bundled with the PHP distribution. See
! 1126: each extensions documentation page for details. Also, read the
! 1127: manual section titled Installation of PECL extensions for details
! 1128: on PECL. An increasingly large number of PHP extensions are found
! 1129: in PECL, and these extensions require a separate download.
! 1130:
! 1131: Note: If you are running a server module version of PHP remember to
! 1132: restart your web server to reflect your changes to php.ini.
! 1133:
! 1134: The following table describes some of the extensions available and
! 1135: required additional dlls.
! 1136:
! 1137: Table 2-1. PHP Extensions
! 1138: Extension Description Notes
! 1139: php_bz2.dll bzip2 compression functions None
! 1140: php_calendar.dll Calendar conversion functions
! 1141: php_cpdf.dll ClibPDF functions None
! 1142: php_crack.dll Crack functions None
! 1143: php_ctype.dll ctype family functions
! 1144: php_curl.dll CURL, Client URL library functions Requires: libeay32.dll,
! 1145: ssleay32.dll (bundled)
! 1146: php_db.dll DBM functions Deprecated. Use DBA instead (php_dba.dll)
! 1147: php_dba.dll DBA: DataBase (dbm-style) Abstraction layer functions None
! 1148: php_dbase.dll dBase functions None
! 1149: php_dbx.dll dbx functions
! 1150: php_exif.dll EXIF functions php_mbstring.dll. And, php_exif.dll must be
! 1151: loaded after php_mbstring.dll in php.ini.
! 1152: php_fdf.dll FDF: Forms Data Format functions. Requires: fdftk.dll
! 1153: (bundled)
! 1154: php_filepro.dll filePro functions Read-only access
! 1155: php_ftp.dll FTP functions
! 1156: php_gd2.dll GD library image functions GD2
! 1157: php_gettext.dll Gettext functions, requires libintl-1.dll,
! 1158: iconv.dll (bundled).
! 1159: php_iconv.dll ICONV characterset conversion Requires: iconv.dll
! 1160: php_imap.dll IMAP POP3 and NNTP functions None
! 1161: php_interbase.dll InterBase functions Requires: gds32.dll (bundled)
! 1162: php_ldap.dll LDAP functions requires libeay32.dll, ssleay32.dll (bundled)
! 1163: php_mbstring.dll Multi-Byte String functions None
! 1164: php_mcrypt.dll Mcrypt Encryption functions Requires: libmcrypt.dll
! 1165: php_mime_magic.dll Mimetype functions Requires: magic.mime (bundled)
! 1166: php_ming.dll Ming functions for Flash None
! 1167: php_msql.dll mSQL functions Requires: msql.dll (bundled)
! 1168: php_mssql.dll MSSQL functions Requires: ntwdblib.dll (bundled)
! 1169: php_mysql.dll MySQL functions PHP >= 5.0.0, requires libmysql.dll
! 1170: (bundled)
! 1171: php_mysqli.dll MySQLi functions PHP >= 5.0.0, requires libmysql.dll
! 1172: (libmysqli.dll in PHP <= 5.0.2) (bundled)
! 1173: php_oci8.dll Oracle 8 functions Requires: Oracle 8.1+ client libraries
! 1174: php_openssl.dll OpenSSL functions Requires: libeay32.dll (bundled)
! 1175: php_oracle.dll Oracle functions Requires: Oracle 7 client libraries
! 1176: php_pgsql.dll PostgreSQL functions None
! 1177: php_printer.dll Printer functions None
! 1178: php_shmop.dll Shared Memory functions None
! 1179: php_snmp.dll SNMP get and walk functions NT only!
! 1180: php_soap.dll SOAP functions PHP >= 5.0.0
! 1181: php_sockets.dll Socket functions None
! 1182: php_sybase_ct.dll Sybase functions Requires: Sybase client libraries
! 1183: php_tidy.dll Tidy functions PHP >= 5.0.0
! 1184: php_tokenizer.dll Tokenizer functions Built in since PHP 4.3.0
! 1185: php_xmlrpc.dll XML-RPC functions PHP >= 4.2.1 requires: iconv.dll
! 1186: (bundled)
! 1187: php_xslt.dll XSLT requires libxslt.dll, iconv.dll (bundled).
! 1188: php_zip.dll Zip File functions
! 1189: php_zlib.dll ZLib compression functions
! 1190: __________________________________________________________________
! 1191:
! 1192: Chapter 3. Installation of PECL extensions
! 1193:
! 1194: Introduction to PECL Installations
! 1195:
! 1196: PECL is a repository of PHP extensions that are made available to you
! 1197: via the PEAR packaging system. This section of the manual is intended
! 1198: to demonstrate how to obtain and install PECL extensions.
! 1199:
! 1200: These instructions assume /your/phpsrcdir/ is the path to the PHP
! 1201: source distribution, and that extname is the name of the PECL
! 1202: extension. Adjust accordingly. These instructions also assume a
! 1203: familiarity with the pear command. The information in the PEAR manual
! 1204: for the pear command also applies to the pecl command.
! 1205:
! 1206: To be useful, a shared extension must be built, installed, and loaded.
! 1207: The methods described below provide you with various instructions on
! 1208: how to build and install the extensions, but they do not automatically
! 1209: load them. Extensions can be loaded by adding an extension directive.
! 1210: To this php.ini file, or through the use of the dl() function.
! 1211:
! 1212: When building PHP modules, it's important to have known-good versions
! 1213: of the required tools (autoconf, automake, libtool, etc.) See the
! 1214: SVN Instructions for details on the required tools, and required
! 1215: versions.
! 1216: __________________________________________________________________
! 1217:
! 1218: Downloading PECL extensions
! 1219:
! 1220: There are several options for downloading PECL extensions, such as:
! 1221:
! 1222: * http://pecl.php.net
! 1223: The PECL web site contains information about the different
! 1224: extensions that are offered by the PHP Development Team. The
! 1225: information available here includes: ChangeLog, release notes,
! 1226: requirements and other similar details.
! 1227: * pecl download extname
! 1228: PECL extensions that have releases listed on the PECL web site are
! 1229: available for download and installation using the pecl command.
! 1230: Specific revisions may also be specified.
! 1231: * SVN
! 1232: Most PECL extensions also reside in SVN. A web-based view may be
! 1233: seen at http://svn.php.net/pecl/. To download straight from SVN,
! 1234: the following sequence of commands may be used.
! 1235:
! 1236: $ svn co http://svn.php.net/repository/pecl/<extname>/trunk
! 1237:
! 1238: * Windows downloads
! 1239: Windows users may find compiled PECL binaries by downloading the
! 1240: Collection of PECL modules from the PHP Downloads page, or by
! 1241: retrieving a PECL Snapshot or an extension DLL on PECL4WIN. To
! 1242: compile PHP under Windows, read the appropriate chapter.
! 1243: __________________________________________________________________
! 1244:
! 1245: PECL for Windows users
! 1246:
! 1247: As with any other PHP extension DLL, installation is as simple as
! 1248: copying the PECL extension DLLs into the extension_dir folder and
! 1249: loading them from php.ini. For example, add the following line to your
! 1250: php.ini:
! 1251:
! 1252: extension=php_extname.dll
! 1253:
! 1254: After doing this, restart the web server.
! 1255: __________________________________________________________________
! 1256:
! 1257: Compiling shared PECL extensions with the pecl command
! 1258:
! 1259: PECL makes it easy to create shared PHP extensions. Using the pecl
! 1260: command, do the following:
! 1261:
! 1262: $ pecl install extname
! 1263:
! 1264: This will download the source for extname, compile, and install
! 1265: extname.so into your extension_dir. extname.so may then be loaded via
! 1266: php.ini
! 1267:
! 1268: By default, the pecl command will not install packages that are marked
! 1269: with the alpha or beta state. If no stable packages are available, you
! 1270: may install a beta package using the following command:
! 1271:
! 1272: $ pecl install extname-beta
! 1273:
! 1274: You may also install a specific version using this variant:
! 1275:
! 1276: $ pecl install extname-0.1
! 1277: __________________________________________________________________
! 1278:
! 1279: Compiling shared PECL extensions with phpize
! 1280:
! 1281: Sometimes, using the pecl installer is not an option. This could be
! 1282: because you're behind a firewall, or it could be because the extension
! 1283: you want to install is not available as a PECL compatible package, such
! 1284: as unreleased extensions from SVN. If you need to build such an
! 1285: extension, you can use the lower-level build tools to perform the build
! 1286: manually.
! 1287:
! 1288: The phpize command is used to prepare the build environment for a PHP
! 1289: extension. In the following sample, the sources for an extension are in
! 1290: a directory named extname:
! 1291:
! 1292: $ cd extname
! 1293: $ phpize
! 1294: $ ./configure
! 1295: $ make
! 1296: # make install
! 1297:
! 1298: A successful install will have created extname.so and put it into the
! 1299: PHP extensions directory. You'll need to and adjust php.ini and add an
! 1300: extension=extname.so line before you can use the extension.
! 1301:
! 1302: If the system is missing the phpize command, and precompiled packages
! 1303: (like RPM's) are used, be sure to also install the appropriate devel
! 1304: version of the PHP package as they often include the phpize command
! 1305: along with the appropriate header files to build PHP and its
! 1306: extensions.
! 1307:
! 1308: Execute phpize --help to display additional usage information.
! 1309: __________________________________________________________________
! 1310:
! 1311: Compiling PECL extensions statically into PHP
! 1312:
! 1313: You might find that you need to build a PECL extension statically into
! 1314: your PHP binary. To do this, you'll need to place the extension source
! 1315: under the php-src/ext/ directory and tell the PHP build system to
! 1316: regenerate its configure script.
! 1317:
! 1318: $ cd /your/phpsrcdir/ext
! 1319: $ pecl download extname
! 1320: $ gzip -d < extname.tgz | tar -xvf -
! 1321: $ mv extname-x.x.x extname
! 1322:
! 1323: This will result in the following directory:
! 1324:
! 1325: /your/phpsrcdir/ext/extname
! 1326:
! 1327: From here, force PHP to rebuild the configure script, and then build
! 1328: PHP as normal:
! 1329:
! 1330: $ cd /your/phpsrcdir
! 1331: $ rm configure
! 1332: $ ./buildconf --force
! 1333: $ ./configure --help
! 1334: $ ./configure --with-extname --enable-someotherext --with-foobar
! 1335: $ make
! 1336: $ make install
! 1337:
! 1338: Note: To run the 'buildconf' script you need autoconf 2.13 and
! 1339: automake 1.4+ (newer versions of autoconf may work, but are not
! 1340: supported).
! 1341:
! 1342: Whether --enable-extname or --with-extname is used depends on the
! 1343: extension. Typically an extension that does not require external
! 1344: libraries uses --enable. To be sure, run the following after buildconf:
! 1345:
! 1346: $ ./configure --help | grep extname
! 1347: __________________________________________________________________
! 1348:
! 1349: Chapter 4. Problems?
! 1350:
! 1351: Read the FAQ
! 1352:
! 1353: Some problems are more common than others. The most common ones are
! 1354: listed in the PHP FAQ, part of this manual.
! 1355: __________________________________________________________________
! 1356:
! 1357: Other problems
! 1358:
! 1359: If you are still stuck, someone on the PHP installation mailing list
! 1360: may be able to help you. You should check out the archive first, in
! 1361: case someone already answered someone else who had the same problem as
! 1362: you. The archives are available from the support page on
! 1363: http://www.php.net/support.php. To subscribe to the PHP installation
! 1364: mailing list, send an empty mail to
! 1365: php-install-subscribe@lists.php.net. The mailing list address is
! 1366: php-install@lists.php.net.
! 1367:
! 1368: If you want to get help on the mailing list, please try to be precise
! 1369: and give the necessary details about your environment (which operating
! 1370: system, what PHP version, what web server, if you are running PHP as
! 1371: CGI or a server module, safe mode, etc...), and preferably enough code
! 1372: to make others able to reproduce and test your problem.
! 1373: __________________________________________________________________
! 1374:
! 1375: Bug reports
! 1376:
! 1377: If you think you have found a bug in PHP, please report it. The PHP
! 1378: developers probably don't know about it, and unless you report it,
! 1379: chances are it won't be fixed. You can report bugs using the
! 1380: bug-tracking system at http://bugs.php.net/. Please do not send bug
! 1381: reports in mailing list or personal letters. The bug system is also
! 1382: suitable to submit feature requests.
! 1383:
! 1384: Read the How to report a bug document before submitting any bug
! 1385: reports!
! 1386: __________________________________________________________________
! 1387:
! 1388: Chapter 5. Runtime Configuration
! 1389:
! 1390: The configuration file
! 1391:
! 1392: The configuration file (called php3.ini in PHP 3, and simply php.ini as
! 1393: of PHP 4) is read when PHP starts up. For the server module versions of
! 1394: PHP, this happens only once when the web server is started. For the CGI
! 1395: and CLI version, it happens on every invocation.
! 1396:
! 1397: php.ini is searched in these locations (in order):
! 1398:
! 1399: * SAPI module specific location (PHPIniDir directive in Apache 2, -c
! 1400: command line option in CGI and CLI, php_ini parameter in NSAPI,
! 1401: PHP_INI_PATH environment variable in THTTPD)
! 1402: * The PHPRC environment variable. Before PHP 5.2.0 this was checked
! 1403: after the registry key mentioned below.
! 1404: * As of PHP 5.2.0, the following registry locations are searched in
! 1405: order: HKEY_LOCAL_MACHINE\SOFTWARE\PHP\x.y.z\IniFilePath,
! 1406: HKEY_LOCAL_MACHINE\SOFTWARE\PHP\x.y\IniFilePath and
! 1407: HKEY_LOCAL_MACHINE\SOFTWARE\PHP\x\IniFilePath, where x, y and z
! 1408: mean the PHP major, minor and release versions.
! 1409: * HKEY_LOCAL_MACHINE\SOFTWARE\PHP\IniFilePath (Windows Registry
! 1410: location)
! 1411: * Current working directory (except CLI)
! 1412: * The web server's directory (for SAPI modules), or directory of PHP
! 1413: (otherwise in Windows)
! 1414: * Windows directory (C:\windows or C:\winnt) (for Windows), or
! 1415: --with-config-file-path compile time option
! 1416:
! 1417: If php-SAPI.ini exists (where SAPI is used SAPI, so the filename is
! 1418: e.g. php-cli.ini or php-apache.ini), it's used instead of php.ini. SAPI
! 1419: name can be determined by php_sapi_name().
! 1420:
! 1421: Note: The Apache web server changes the directory to root at startup
! 1422: causing PHP to attempt to read php.ini from the root filesystem if
! 1423: it exists.
! 1424:
! 1425: The php.ini directives handled by extensions are documented
! 1426: respectively on the pages of the extensions themselves. The list of the
! 1427: core directives is available in the appendix. Probably not all PHP
! 1428: directives are documented in the manual though. For a complete list of
! 1429: directives available in your PHP version, please read your well
! 1430: commented php.ini file. Alternatively, you may find the latest
! 1431: php.ini from SVN helpful too.
! 1432:
! 1433: Example 5-1. php.ini example
! 1434: ; any text on a line after an unquoted semicolon (;) is ignored
! 1435: [php] ; section markers (text within square brackets) are also ignored
! 1436: ; Boolean values can be set to either:
! 1437: ; true, on, yes
! 1438: ; or false, off, no, none
! 1439: register_globals = off
! 1440: track_errors = yes
! 1441:
! 1442: ; you can enclose strings in double-quotes
! 1443: include_path = ".:/usr/local/lib/php"
! 1444:
! 1445: ; backslashes are treated the same as any other character
! 1446: include_path = ".;c:\php\lib"
! 1447:
! 1448: Since PHP 5.1.0, it is possible to refer to existing .ini variables
! 1449: from within .ini files. Example: open_basedir = ${open_basedir}
! 1450: ":/new/dir".
! 1451: __________________________________________________________________
! 1452:
! 1453: How to change configuration settings
! 1454:
! 1455: Running PHP as an Apache module
! 1456:
! 1457: When using PHP as an Apache module, you can also change the
! 1458: configuration settings using directives in Apache configuration files
! 1459: (e.g. httpd.conf) and .htaccess files. You will need "AllowOverride
! 1460: Options" or "AllowOverride All" privileges to do so.
! 1461:
! 1462: With PHP 4 and PHP 5, there are several Apache directives that allow
! 1463: you to change the PHP configuration from within the Apache
! 1464: configuration files. For a listing of which directives are PHP_INI_ALL,
! 1465: PHP_INI_PERDIR, or PHP_INI_SYSTEM, have a look at the List of php.ini
! 1466: directives appendix.
! 1467:
! 1468: Note: With PHP 3, there are Apache directives that correspond to
! 1469: each configuration setting in the php3.ini name, except the name is
! 1470: prefixed by "php3_".
! 1471:
! 1472: php_value name value
! 1473: Sets the value of the specified directive. Can be used only with
! 1474: PHP_INI_ALL and PHP_INI_PERDIR type directives. To clear a
! 1475: previously set value use none as the value.
! 1476:
! 1477: Note: Don't use php_value to set boolean values. php_flag (see
! 1478: below) should be used instead.
! 1479:
! 1480: php_flag name on|off
! 1481: Used to set a boolean configuration directive. Can be used only
! 1482: with PHP_INI_ALL and PHP_INI_PERDIR type directives.
! 1483:
! 1484: php_admin_value name value
! 1485: Sets the value of the specified directive. This can not be used
! 1486: in .htaccess files. Any directive type set with php_admin_value
! 1487: can not be overridden by .htaccess or virtualhost directives. To
! 1488: clear a previously set value use none as the value.
! 1489:
! 1490: php_admin_flag name on|off
! 1491: Used to set a boolean configuration directive. This can not be
! 1492: used in .htaccess files. Any directive type set with
! 1493: php_admin_flag can not be overridden by .htaccess or virtualhost
! 1494: directives.
! 1495:
! 1496: Example 5-2. Apache configuration example
! 1497: <IfModule mod_php5.c>
! 1498: php_value include_path ".:/usr/local/lib/php"
! 1499: php_admin_flag safe_mode on
! 1500: </IfModule>
! 1501:
! 1502: Caution
! 1503:
! 1504: PHP constants do not exist outside of PHP. For example, in httpd.conf
! 1505: you can not use PHP constants such as E_ALL or E_NOTICE to set the
! 1506: error_reporting directive as they will have no meaning and will
! 1507: evaluate to 0. Use the associated bitmask values instead. These
! 1508: constants can be used in php.ini
! 1509: __________________________________________________________________
! 1510:
! 1511: Changing PHP configuration via the Windows registry
! 1512:
! 1513: When running PHP on Windows, the configuration values can be modified
! 1514: on a per-directory basis using the Windows registry. The configuration
! 1515: values are stored in the registry key HKLM\SOFTWARE\PHP\Per Directory
! 1516: Values, in the sub-keys corresponding to the path names. For example,
! 1517: configuration values for the directory c:\inetpub\wwwroot would be
! 1518: stored in the key HKLM\SOFTWARE\PHP\Per Directory
! 1519: Values\c\inetpub\wwwroot. The settings for the directory would be
! 1520: active for any script running from this directory or any subdirectory
! 1521: of it. The values under the key should have the name of the PHP
! 1522: configuration directive and the string value. PHP constants in the
! 1523: values are not parsed. However, only configuration values changeable in
! 1524: PHP_INI_USER can be set this way, PHP_INI_PERDIR values can not.
! 1525: __________________________________________________________________
! 1526:
! 1527: Other interfaces to PHP
! 1528:
! 1529: Regardless of how you run PHP, you can change certain values at runtime
! 1530: of your scripts through ini_set(). See the documentation on the
! 1531: ini_set() page for more information.
! 1532:
! 1533: If you are interested in a complete list of configuration settings on
! 1534: your system with their current values, you can execute the phpinfo()
! 1535: function, and review the resulting page. You can also access the values
! 1536: of individual configuration directives at runtime using ini_get() or
! 1537: get_cfg_var().
! 1538: __________________________________________________________________
! 1539:
! 1540: Chapter 6. Installation FAQ
! 1541:
! 1542: This section holds common questions about the way to install PHP. PHP
! 1543: is available for almost any OS (except maybe for MacOS before OSX), and
! 1544: almost any web server.
! 1545:
! 1546: To install PHP, follow the instructions in Installing PHP.
! 1547:
! 1548: 1. Why shouldn't I use Apache2 with a threaded MPM in a production
! 1549: environment?
! 1550:
! 1551: 2. Unix/Windows: Where should my php.ini file be located?
! 1552: 3. Unix: I installed PHP, but every time I load a document, I get the
! 1553: message 'Document Contains No Data'! What's going on here?
! 1554:
! 1555: 4. Unix: I installed PHP using RPMS, but Apache isn't processing the
! 1556: PHP pages! What's going on here?
! 1557:
! 1558: 5. Unix: I installed PHP 3 using RPMS, but it doesn't compile with the
! 1559: database support I need! What's going on here?
! 1560:
! 1561: 6. Unix: I patched Apache with the FrontPage extensions patch, and
! 1562: suddenly PHP stopped working. Is PHP incompatible with the
! 1563: Apache FrontPage extensions?
! 1564:
! 1565: 7. Unix/Windows: I have installed PHP, but when I try to access a PHP
! 1566: script file via my browser, I get a blank screen.
! 1567:
! 1568: 8. Unix/Windows: I have installed PHP, but when try to access a PHP
! 1569: script file via my browser, I get a server 500 error.
! 1570:
! 1571: 9. Some operating systems: I have installed PHP without errors, but
! 1572: when I try to start apache I get undefined symbol errors:
! 1573:
! 1574: [mybox:user /src/php5] root# apachectl configtest
! 1575: apachectl: /usr/local/apache/bin/httpd Undefined symbols:
! 1576: _compress
! 1577: _uncompress
! 1578:
! 1579: 10. Windows: I have installed PHP, but when I to access a PHP script
! 1580: file via my browser, I get the error:
! 1581:
! 1582: cgi error:
! 1583: The specified CGI application misbehaved by not
! 1584: returning a complete set of HTTP headers.
! 1585: The headers it did return are:
! 1586:
! 1587: 11. Windows: I've followed all the instructions, but still can't get
! 1588: PHP and IIS to work together!
! 1589:
! 1590: 12. When running PHP as CGI with IIS, PWS, OmniHTTPD or Xitami, I get
! 1591: the following error: Security Alert! PHP CGI cannot be accessed
! 1592: directly..
! 1593:
! 1594: 13. How do I know if my php.ini is being found and read? It seems like
! 1595: it isn't as my changes aren't being implemented.
! 1596:
! 1597: 14. How do I add my PHP directory to the PATH on Windows?
! 1598: 15. How do I make the php.ini file available to PHP on windows?
! 1599: 16. Is it possible to use Apache content negotiation (MultiViews
! 1600: option) with PHP?
! 1601:
! 1602: 17. Is PHP limited to process GET and POST request methods only?
! 1603:
! 1604: 1. Why shouldn't I use Apache2 with a threaded MPM in a production
! 1605: environment?
! 1606:
! 1607: PHP is glue. It is the glue used to build cool web applications by
! 1608: sticking dozens of 3rd-party libraries together and making it all
! 1609: appear as one coherent entity through an intuitive and easy to learn
! 1610: language interface. The flexibility and power of PHP relies on the
! 1611: stability and robustness of the underlying platform. It needs a working
! 1612: OS, a working web server and working 3rd-party libraries to glue
! 1613: together. When any of these stop working PHP needs ways to identify the
! 1614: problems and fix them quickly. When you make the underlying framework
! 1615: more complex by not having completely separate execution threads,
! 1616: completely separate memory segments and a strong sandbox for each
! 1617: request to play in, feet of clay are introduced into PHP's system.
! 1618:
! 1619: If you feel you have to use a threaded MPM, look at a FastCGI
! 1620: configuration where PHP is running in its own memory space.
! 1621:
! 1622: And finally, this warning against using a threaded MPM is not as strong
! 1623: for Windows systems because most libraries on that platform tend to be
! 1624: threadsafe.
! 1625:
! 1626: 2. Unix/Windows: Where should my php.ini file be located?
! 1627:
! 1628: By default on Unix it should be in /usr/local/lib which is
! 1629: <install-path>/lib. Most people will want to change this at
! 1630: compile-time with the --with-config-file-path flag. You would, for
! 1631: example, set it with something like:
! 1632: --with-config-file-path=/etc
! 1633:
! 1634: And then you would copy php.ini-production from the distribution to
! 1635: /etc/php.ini and edit it to make any local changes you want.
! 1636: --with-config-file-scan-dir=PATH
! 1637:
! 1638: On Windows the default path for the php.ini file is the Windows
! 1639: directory. If you're using the Apache webserver, php.ini is first
! 1640: searched in the Apaches install directory, e.g. c:\program files\apache
! 1641: group\apache. This way you can have different php.ini files for
! 1642: different versions of Apache on the same machine.
! 1643:
! 1644: See also the chapter about the configuration file.
! 1645:
! 1646: 3. Unix: I installed PHP, but every time I load a document, I get the
! 1647: message 'Document Contains No Data'! What's going on here?
! 1648:
! 1649: This probably means that PHP is having some sort of problem and is
! 1650: core-dumping. Look in your server error log to see if this is the case,
! 1651: and then try to reproduce the problem with a small test case. If you
! 1652: know how to use 'gdb', it is very helpful when you can provide a
! 1653: backtrace with your bug report to help the developers pinpoint the
! 1654: problem. If you are using PHP as an Apache module try something like:
! 1655:
! 1656: * Stop your httpd processes
! 1657: * gdb httpd
! 1658: * Stop your httpd processes
! 1659: * > run -X -f /path/to/httpd.conf
! 1660: * Then fetch the URL causing the problem with your browser
! 1661: * > run -X -f /path/to/httpd.conf
! 1662: * If you are getting a core dump, gdb should inform you of this now
! 1663: * type: bt
! 1664: * You should include your backtrace in your bug report. This should
! 1665: be submitted to http://bugs.php.net/
! 1666:
! 1667: If your script uses the regular expression functions (ereg() and
! 1668: friends), you should make sure that you compiled PHP and Apache with
! 1669: the same regular expression package. This should happen automatically
! 1670: with PHP and Apache 1.3.x
! 1671:
! 1672: 4. Unix: I installed PHP using RPMS, but Apache isn't processing the
! 1673: PHP pages! What's going on here?
! 1674:
! 1675: Assuming you installed both Apache and PHP from RPM packages, you need
! 1676: to uncomment or add some or all of the following lines in your
! 1677: httpd.conf file:
! 1678: # Extra Modules
! 1679: AddModule mod_php.c
! 1680: AddModule mod_php3.c
! 1681: AddModule mod_perl.c
! 1682:
! 1683: # Extra Modules
! 1684: LoadModule php_module modules/mod_php.so
! 1685: LoadModule perl_module modules/libperl.so
! 1686:
! 1687: And add:
! 1688: AddType application/x-httpd-php3 .php3 # for PHP 3
! 1689: AddType application/x-httpd-php .php # for PHP 4
! 1690:
! 1691: ... to the global properties, or to the properties of the VirtualDomain
! 1692: you want to have PHP support added to.
! 1693:
! 1694: 5. Unix: I installed PHP 3 using RPMS, but it doesn't compile with the
! 1695: database support I need! What's going on here?
! 1696:
! 1697: Due to the way PHP 3 built, it is not easy to build a complete flexible
! 1698: PHP RPM. This issue is addressed in PHP 4. For PHP 3, we currently
! 1699: suggest you use the mechanism described in the INSTALL.REDHAT file in
! 1700: the PHP distribution. If you insist on using an RPM version of PHP 3,
! 1701: read on...
! 1702:
! 1703: The RPM packagers are setting up the RPMS to install without database
! 1704: support to simplify installations and because RPMS use /usr/ instead of
! 1705: the standard /usr/local/ directory for files. You need to tell the RPM
! 1706: spec file which databases to support and the location of the top-level
! 1707: of your database server.
! 1708:
! 1709: This example will explain the process of adding support for the popular
! 1710: MySQL database server, using the mod installation for Apache.
! 1711:
! 1712: Of course all of this information can be adjusted for any database
! 1713: server that PHP supports. We will assume you installed MySQL and Apache
! 1714: completely with RPMS for this example as well.
! 1715:
! 1716: * First remove mod_php3 :
! 1717:
! 1718: rpm -e mod_php3
! 1719:
! 1720: * Then get the source rpm and INSTALL it, NOT --rebuild
! 1721:
! 1722: rpm -Uvh mod_php3-3.0.5-2.src.rpm
! 1723:
! 1724: * Then edit the /usr/src/redhat/SPECS/mod_php3.spec file
! 1725: In the %build section add the database support you want, and the
! 1726: path.
! 1727: For MySQL you would add --with-mysql=/usr The %build section will
! 1728: look something like this:
! 1729:
! 1730: ./configure --prefix=/usr \
! 1731: --with-apxs=/usr/sbin/apxs \
! 1732: --with-config-file-path=/usr/lib \
! 1733: --enable-debug=no \
! 1734: --enable-safe-mode \
! 1735: --with-exec-dir=/usr/bin \
! 1736: --with-mysql=/usr \
! 1737: --with-system-regex
! 1738:
! 1739: * Once this modification is made then build the binary rpm as
! 1740: follows:
! 1741:
! 1742: rpm -bb /usr/src/redhat/SPECS/mod_php3.spec
! 1743:
! 1744: * Then install the rpm
! 1745:
! 1746: rpm -ivh /usr/src/redhat/RPMS/i386/mod_php3-3.0.5-2.i386.rpm
! 1747:
! 1748: Make sure you restart Apache, and you now have PHP 3 with MySQL support
! 1749: using RPM's. Note that it is probably much easier to just build from
! 1750: the distribution tarball of PHP 3 and follow the instructions in
! 1751: INSTALL.REDHAT found in that distribution.
! 1752:
! 1753: 6. Unix: I patched Apache with the FrontPage extensions patch, and
! 1754: suddenly PHP stopped working. Is PHP incompatible with the Apache
! 1755: FrontPage extensions?
! 1756:
! 1757: No, PHP works fine with the FrontPage extensions. The problem is that
! 1758: the FrontPage patch modifies several Apache structures, that PHP relies
! 1759: on. Recompiling PHP (using 'make clean ; make') after the FP patch is
! 1760: applied would solve the problem.
! 1761:
! 1762: 7. Unix/Windows: I have installed PHP, but when I try to access a PHP
! 1763: script file via my browser, I get a blank screen.
! 1764:
! 1765: Do a 'view source' in the web browser and you will probably find that
! 1766: you can see the source code of your PHP script. This means that the web
! 1767: server did not send the script to PHP for interpretation. Something is
! 1768: wrong with the server configuration - double check the server
! 1769: configuration against the PHP installation instructions.
! 1770:
! 1771: 8. Unix/Windows: I have installed PHP, but when try to access a PHP
! 1772: script file via my browser, I get a server 500 error.
! 1773:
! 1774: Something went wrong when the server tried to run PHP. To get to see a
! 1775: sensible error message, from the command line, change to the directory
! 1776: containing the PHP executable (php.exe on Windows) and run php -i. If
! 1777: PHP has any problems running, then a suitable error message will be
! 1778: displayed which will give you a clue as to what needs to be done next.
! 1779: If you get a screen full of HTML codes (the output of the phpinfo()
! 1780: function) then PHP is working, and your problem may be related to your
! 1781: server configuration which you should double check.
! 1782:
! 1783: 9. Some operating systems: I have installed PHP without errors, but
! 1784: when I try to start apache I get undefined symbol errors:
! 1785: [mybox:user /src/php5] root# apachectl configtest
! 1786: apachectl: /usr/local/apache/bin/httpd Undefined symbols:
! 1787: _compress
! 1788: _uncompress
! 1789:
! 1790: This has actually nothing to do with PHP, but with the MySQL client
! 1791: libraries. Some need --with-zlib, others do not. This is also covered
! 1792: in the MySQL FAQ.
! 1793:
! 1794: 10. Windows: I have installed PHP, but when I to access a PHP script
! 1795: file via my browser, I get the error:
! 1796: cgi error:
! 1797: The specified CGI application misbehaved by not
! 1798: returning a complete set of HTTP headers.
! 1799: The headers it did return are:
! 1800:
! 1801: This error message means that PHP failed to output anything at all. To
! 1802: get to see a sensible error message, from the command line, change to
! 1803: the directory containing the PHP executable (php.exe on Windows) and
! 1804: run php -i. If PHP has any problems running, then a suitable error
! 1805: message will be displayed which will give you a clue as to what needs
! 1806: to be done next. If you get a screen full of HTML codes (the output of
! 1807: the phpinfo() function) then PHP is working.
! 1808:
! 1809: Once PHP is working at the command line, try accessing the script via
! 1810: the browser again. If it still fails then it could be one of the
! 1811: following:
! 1812:
! 1813: * File permissions on your PHP script, php.exe, php5ts.dll, php.ini
! 1814: or any PHP extensions you are trying to load are such that the
! 1815: anonymous internet user ISUR_<machinename> cannot access them.
! 1816: * The script file does not exist (or possibly isn't where you think
! 1817: it is relative to your web root directory). Note that for IIS you
! 1818: can trap this error by ticking the 'check file exists' box when
! 1819: setting up the script mappings in the Internet Services Manager. If
! 1820: a script file does not exist then the server will return a 404
! 1821: error instead. There is also the additional benefit that IIS will
! 1822: do any authentication required for you based on the NTLanMan
! 1823: permissions on your script file.
! 1824:
! 1825: 11. Windows: I've followed all the instructions, but still can't get
! 1826: PHP and IIS to work together!
! 1827:
! 1828: Make sure any user who needs to run a PHP script has the rights to run
! 1829: php.exe! IIS uses an anonymous user which is added at the time IIS is
! 1830: installed. This user needs rights to php.exe. Also, any authenticated
! 1831: user will also need rights to execute php.exe. And for IIS4 you need to
! 1832: tell it that PHP is a script engine. Also, you will want to read this
! 1833: faq.
! 1834:
! 1835: 12. When running PHP as CGI with IIS, PWS, OmniHTTPD or Xitami, I get
! 1836: the following error: Security Alert! PHP CGI cannot be accessed
! 1837: directly..
! 1838:
! 1839: You must set the cgi.force_redirect directive to 0. It defaults to 1 so
! 1840: be sure the directive isn't commented out (with a ;). Like all
! 1841: directives, this is set in php.ini
! 1842:
! 1843: Because the default is 1, it's critical that you're 100% sure that the
! 1844: correct php.ini file is being read. Read this faq for details.
! 1845:
! 1846: 13. How do I know if my php.ini is being found and read? It seems like
! 1847: it isn't as my changes aren't being implemented.
! 1848:
! 1849: To be sure your php.ini is being read by PHP, make a call to phpinfo()
! 1850: and near the top will be a listing called Configuration File (php.ini).
! 1851: This will tell you where PHP is looking for php.ini and whether or not
! 1852: it's being read. If just a directory PATH exists than it's not being
! 1853: read and you should put your php.ini in that directory. If php.ini is
! 1854: included within the PATH than it is being read.
! 1855:
! 1856: If php.ini is being read and you're running PHP as a module, then be
! 1857: sure to restart your web server after making changes to php.ini
! 1858:
! 1859: 14. How do I add my PHP directory to the PATH on Windows?
! 1860:
! 1861: On Windows NT, 2000, XP and 2003:
! 1862:
! 1863: * Go to Control Panel and open the System icon (Start -> Settings ->
! 1864: Control Panel -> System, or just Start -> Control Panel -> System
! 1865: for Windows XP/2003)
! 1866: * Go to the Advanced tab
! 1867: * Click on the 'Environment Variables' button
! 1868: * Look into the 'System Variables' pane
! 1869: * Find the Path entry (you may need to scroll to find it)
! 1870: * Double click on the Path entry
! 1871: * Enter your PHP directory at the end, including ';' before (e.g.
! 1872: ;C:\php)
! 1873: * Press OK and restart your computer
! 1874:
! 1875: On Windows 98/Me you need to edit the autoexec.bat file:
! 1876:
! 1877: * Open the Notepad (Start -> Run and enter notepad)
! 1878: * Open the C:\autoexec.bat file
! 1879: * Locate the line with PATH=C:\WINDOWS;C:\WINDOWS\COMMAND;..... and
! 1880: add: ;C:\php to the end of the line
! 1881: * Save the file and restart your computer
! 1882:
! 1883: Note: Be sure to reboot after following the steps above to ensure
! 1884: that the PATH changes are applied.
! 1885:
! 1886: The PHP manual used to promote the copying of files into the Windows
! 1887: system directory, this is because this directory (C:\Windows, C:\WINNT,
! 1888: etc.) is by default in the systems PATH. Copying files into the Windows
! 1889: system directory has long since been deprecated and may cause problems.
! 1890:
! 1891: 15. How do I make the php.ini file available to PHP on windows?
! 1892:
! 1893: There are several ways of doing this. If you are using Apache, read
! 1894: their installation specific instructions (Apache 1, Apache 2),
! 1895: otherwise you must set the PHPRC environment variable:
! 1896:
! 1897: On Windows NT, 2000, XP and 2003:
! 1898:
! 1899: * Go to Control Panel and open the System icon (Start -> Settings ->
! 1900: Control Panel -> System, or just Start -> Control Panel -> System
! 1901: for Windows XP/2003)
! 1902: * Go to the Advanced tab
! 1903: * Click on the 'Environment Variables' button
! 1904: * Look into the 'System variables' pane
! 1905: * Click on 'New' and enter 'PHPRC' as the variable name and the
! 1906: directory where php.ini is located as the variable value (e.g.
! 1907: C:\php)
! 1908: * Press OK and restart your computer
! 1909:
! 1910: On Windows 98/Me you need to edit the autoexec.bat file:
! 1911:
! 1912: * Open the Notepad (Start -> Run and enter notepad)
! 1913: * Open the C:\autoexec.bat file
! 1914: * Add a new line to the end of the file: set PHPRC=C:\php (replace
! 1915: C:\php with the directory where php.ini is located). Please note
! 1916: that the path cannot contain spaces. For instance, if you have
! 1917: installed PHP in C:\Program Files\PHP, you would enter
! 1918: C:\PROGRA~1\PHP instead.
! 1919: * Save the file and restart your computer
! 1920:
! 1921: 16. Is it possible to use Apache content negotiation (MultiViews
! 1922: option) with PHP?
! 1923:
! 1924: If links to PHP files include extension, everything works perfect. This
! 1925: FAQ is only for the case when links to PHP files don't include
! 1926: extension and you want to use content negotiation to choose PHP files
! 1927: from URL with no extension. In this case, replace the line AddType
! 1928: application/x-httpd-php .php with:
! 1929: # PHP 4
! 1930: AddHandler php-script php
! 1931: AddType text/html php
! 1932:
! 1933: # PHP 5
! 1934: AddHandler php5-script php
! 1935: AddType text/html php
! 1936:
! 1937: This solution doesn't work for Apache 1 as PHP module doesn't catch
! 1938: php-script.
! 1939:
! 1940: 17. Is PHP limited to process GET and POST request methods only?
! 1941:
! 1942: No, it is possible to handle any request method, e.g. CONNECT. Proper
! 1943: response status can be sent with header(). If only GET and POST methods
! 1944: should be handled, it can be achieved with this Apache configuration:
! 1945: <LimitExcept GET POST>
! 1946: Deny from all
! 1947: </LimitExcept>
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>