PHP Manual
Prev Chapter 2. Installation
Installation on Windows 95/98/NT systems
This install guide will help you install and configure PHP on your Windows 9x/NT webservers. This guide was compiled by Bob Silva. The latest revision can be found at http://www.umesd.k12.or.us/php/win32install.html.
This guide provides installation support for:
Personal Web Server (Newest version recommended)
Internet Information Server 3 or 4
Apache 1.3.x
Omni HTTPd 2.0b1
General Installation Steps
The following steps should be performed on all installations before the server specific instructions.
Extract the distribution file to a directory of your choice. \"C:\PHP3\\" is a good start.
Copy the file, \'php3.ini-dist\' to your \'%WINDOWS%\' directory and rename it to \'php3.ini\'. Your \'%WINDOWS%\' directory is typically:
c:\windows for Windows 95/98
c:\winnt or c:\winnt40 for NT servers
CONFIGURATION OF PHP ON YOUR SYSYTEM
The configuration file
The configuration file (called php3.ini in PHP 3.0, and simply php.ini as of PHP 4.0) is read when PHP starts up. For the server module versions of PHP, this happens only once when the web server is started. For the CGI version, it happens on every invocation.
When using PHP as an Apache module, you can also change the configuration settings using directives in Apache configuration files and .htaccess files.
With PHP 3.0, there are Apache directives that correspond to each configuration setting in the php3.ini name, except the name is prefixed by \"php3_\".
With PHP 4.0, there are just a few Apache directives that allow you to change the PHP configuration settings.
php_value name value
This sets the value of the specified variable.
php_flag name on|off
This is used to set a Boolean configuration option.
php_admin_value name value
This sets the value of the specified variable. \"Admin\" configuration settings can only be set from within the main Apache configuration files, and not from .htaccess files.
php_admin_flag name on|off
This is used to set a Boolean configuration option.
You can view the settings of the configuration values in the output of phpinfo(). You can also access the values of individial configuration settings using get_cfg_var().
General Configuration Directives
asp_tags boolean
Enables the use of ASP-like <% %> tags in addition to the usual <?php ?> tags. This includes the variable-value printing shorthand of <%= $value %>. For more information, see Escaping from HTML.
Note: Support for ASP-style tags was added in 3.0.4.
auto_append_file string
Specifies the name of a file that is automatically parsed after the main file. The file is included as if it was called with the include() function, so include_path is used.
The special value none disables auto-appending.
Note: If the script is terminated with exit(), auto-append will not occur.
auto_prepend_file string
Specifies the name of a file that is automatically parsed before the main file. The file is included as if it was called with the include() function, so include_path is used.
The special value none disables auto-prepending.
cgi_ext string
display_errors boolean
This determines whether errors should be printed to the screen as part of the HTML output or not.
doc_root string
PHP\'s \"root directory\" on the server. Only used if non-empty. If PHP is configured with safe mode, no files outside this directory are served.
engine boolean
This directive is really only useful in the Apache module version of PHP. It is used by sites that would like to turn PHP parsing on and off on a per-directory or per-virtual server basis. By putting php3_engine off in the appropriate places in the httpd.conf file, PHP can be enabled or disabled.
error_log string
Name of file where script errors should be logged. If the special value syslog is used, the errors are sent to the system logger instead. On UNIX, this means syslog(3) and on Windows NT it means the event log. The system logger is not supported on Windows 95.
error_reporting integer
Set the error reporting level. The parameter is an integer representing a bit field. Add the values of the error reporting levels you want.
Table 3-1. Error Reporting Levels
bit value enabled reporting
1 normal errors
2 normal warnings
4 parser errors
8 non-critical style-related warnings
The default value for this directive is 7 (normal errors, normal warnings and parser errors are shown).
open_basedir string
Limit the files that can be opened by PHP to the specified directory-tree.
When a script tries to open a file with, for example, fopen or gzopen, the location of the file is checked. When the file is outside the specified directory-tree, PHP will refuse to open it. All symbolic links are resolved, so it\'s not possible to avoid this restriction with a symlink.
The special value . indicates that the directory in which the script is stored will be used as base-directory.
Under Windows, separate the directories with a semicolon. On all other systems, separate the directories with a colon. As an Apache module, open_basedir paths from parent directories are now automatically inherited.
Note: Support for multiple directories was added in 3.0.7.
The default is to allow all files to be opened.
gpc_order string
Set the order of GET/POST/COOKIE variable parsing. The default setting of this directive is \"GPC\". Setting this to \"GP\", for example, will cause PHP to completely ignore cookies and to overwrite any GET method variables with POST-method variables of the same name.
ignore_user_abort string
On by default. If changed to Off scripts will be terminated as soon as they try to output something after a client has aborted their connection. ignore_user_abort().
include_path string
Specifies a list of directories where the require(), include() and fopen_with_path() functions look for files. The format is like the system\'s PATH environment variable: a list of directories separated with a colon in UNIX or semicolon in Windows. Example 3-1. UNIX include_path
1
2 include_path=.:/home/httpd/php-lib
3
Example 3-2. Windows include_path
1
2 include_path=\".;c:\www\phplib\"
3
The default value for this directive is . (only the current directory).
isapi_ext string
log_errors boolean
Tells whether script error messages should be logged to the server\'s error log. This option is thus server-specific.
magic_quotes_gpc boolean
Sets the magic_quotes state for GPC (Get/Post/Cookie) operations. When magic_quotes are on, all \' (single-quote), \" (double quote), \ (backslash) and NUL\'s are escaped with a backslash automatically. If magic_quotes_sybase is also on, a single-quote is escaped with a single-quote instead of a backslash.
magic_quotes_runtime boolean
If magic_quotes_runtime is enabled, most functions that return data from any sort of external source including databases and text files will have quotes escaped with a backslash. If magic_quotes_sybase is also on, a single-quote is escaped with a single-quote instead of a backslash.
magic_quotes_sybase boolean
If magic_quotes_sybase is also on, a single-quote is escaped with a single-quote instead of a backslash if magic_quotes_gpc or magic_quotes_runtime is enabled.
max_execution_time integer
This sets the maximum time in seconds a script is allowed to take before it is terminated by the parser. This helps prevent poorly written scripts from tieing up the server.
memory_limit integer
This sets the maximum amount of memory in bytes that a script is allowed to allocate. This helps prevent poorly written scripts for eating up all available memory on a server.
nsapi_ext string
short_open_tag boolean
Tells whether the short form (<? ?>of PHP\'s open tag should be allowed. If you want to use PHP in combination with XML, you have to disable this option. If disabled, you must use the long form of the open tag (<?php ?>).
sql.safe_mode boolean
track_errors boolean
If enabled, the last error message will always be present in the global variable $php_errormsg.
track_vars boolean
If enabled, GET, POST and cookie input can be found in the global associative arrays $HTTP_GET_VARS, $HTTP_POST_VARS and $HTTP_COOKIE_VARS, respectively.
upload_tmp_dir string
The temporary directory used for storing files when doing file upload. Must be writable by whatever user PHP is running as.
user_dir string
The base name of the directory used on a user\'s home directory for PHP files, for example public_html.
warn_plus_overloading boolean
If enabled, this option makes PHP output a warning when the plus (+) operator is used on strings. This is to make it easier to find scripts that need to be rewritten to using the string concatenator instead (.).
AND THEN JUST SIMPLE PHP EXAMPLE LIKE
<?
print \"My First PHP Program\" ;
?>
Edit your \'php3.ini\' file:
You will need to change the \'extension_dir\' setting to point to your php-install-dir, or where you have placed your \'php3_*.dll\' files. ex: c:\php3
If you are using Omni Httpd, do not follow the next step. Set the \'doc_root\' to point to your webservers document_root. ex: c:\apache\htdocs or c:\webroot
Choose which modules you would like to load when PHP starts. You can uncomment the: \'extension=php3.dll\' lines to load these modules. Some modules require you to have additional libraries installed on your system for the module to work correctly. The PHP FAQ has more information on where to get supporting libraries. You can also load a module dynamically in your script using: dl(\"php.dll\");
THIS IS JUST FOR UNDERSTANDING..
On PWS and IIS, you can set the browscap.ini to point to: \'c:\windows\system\inetsrv\browscap.ini\' on Windows 95/98 and \'c:\winnt\system32\inetsrv\browscap.ini\' on NT Server. Additional information on using the browscap functionality in PHP can be found at this mirror, select the \"source\" button to see it in action.
The DLLs for PHP extensions are prefixed with \'php3_\'. This prevents confusion between PHP extensions and their supporting libraries.
Windows 95/98/NT and PWS/IIS 3
The recommended method for configuring these servers is to use the INF file included with the distribution (php_iis_reg.inf). You may want to edit this file and make sure the extensions and PHP install directories match your configuration. Or you can follow the steps below to do it manually.
WARNING: These steps involve working directly with the windows registry. One error here can leave your system in an unstable state. We highly recommend that you back up your registry first. The PHP Development team will not be held responsible if you damage your registry.
Windows NT and IIS 4
To install PHP on an NT Server running IIS 4, follow these instructions:
In Internet Service Manager (MMC), select the Web site or the starting point directory of an application.
Open the directory\'s property sheets (by right clicking and selecting properties), and then click the Home Directory, Virtual Directory, or Directory tab.
Click the Configuration button, and then click the App Mappings tab.
Click Add, and in the Executable box, type: c:\path-to-php-dir\php.exe %s %s. You MUST have the %s %s on the end, PHP will not function properly if you fail to do this.
In the Extension box, type the file name extension you want associated with PHP scripts. (You must repeat step 5 and 6 for each extension you want accociated with PHP scripts. (.php3 and .phtml are common.)
Set up the appropriate security. (This is done in Internet Service Manager), and if your NT Server uses NTFS file system, add execute rights for I_USR_ to the directory that contains php.exe.