Installed as CGI binary
4 stars based on
PHP will not work on 16 bit platforms such as Windows 3. Windows 95 is no longer supported as of PHP 4. If you have a development environment such as Microsoft Visual Studio, you can also PHP from the original source code. Once you have PHP installed on your Windows system, you may also want to load various extensions for added functionality.
Unpack the content of php installed as cgi binary manual zip archive into a directory of your choice, for example C: The directory and file structure extracted from the zip will look as below: Example 1 PHP 5 package structure. Below is the list of the modules and executables included in the PHP zip distribution: After the php package content has been extracted, copy the php.
If necessary, it is also possible to place the php. Here are a number of settings for the php. Some of these are optional. There are many other directives that may be relevant to your environment - refer to the list of php. The path can be absolute i. Extensions that are listed lower in the php. This file needs to be writable for the web server. It is a directory security facility required by many other web servers.
This allows IIS to define the security context that the request runs under. The default for this is 30 seconds. Increase the value of this directive if PHP application take long time to execute. The default iswhich is fine for most PHP applications.
Some of the more complex ones might need more. For security reasons it php installed as cgi binary manual recommended to set it to "Off" on production servers in order not to reveal any security sensitive information that is often included in the error messages.
This directive specified the directory paths where PHP is allowed to perform file system operations. Any file operation outside of the specified paths will result in an error.
This directive is especially useful for locking down the PHP installation in shared hosting environments to prevent PHP scripts from accessing any files outside of the web site's root directory. The values of these directives should be increased if PHP applications need to perform large uploads, such as for example photos or video files.
PHP is now setup on your system. The next step is to choose a web server, and enable it to run PHP. Choose a web server from the table of contents. For instructions on setting up IIS 7. Download and install PHP in accordance to the instructions described in manual installation steps Note: Binaries and Sources Releases. The extension is available for bit and bit platforms - select the right download package for your platform.
Replace the value of the php installed as cgi binary manual parameter with the absolute file path to the php-cgi. Also, it will configure FastCGI extension to use the executable php-cgi. At this point the required installation and configuration steps are completed.
The remaining instructions below are optional but highly recommended for achieving optimal functionality and performance of PHP on IIS. This is controlled by the fastcgi. When impersonation is enabled, PHP will perform all the file system operations on behalf of the user account php installed as cgi binary manual has been determined by IIS authentication.
This ensures that even if the same PHP process is shared across different IIS web sites, the PHP scripts in those web sites will not be able to access each others' files as php installed as cgi binary manual as different user accounts are used for IIS authentication on each web site. For example IIS 5. To determine which user account is used by IIS anonymous authentication, follow these steps: In the Windows Start Menu choose "Run: Expand the list of web sites under the "Web Sites" node in the php installed as cgi binary manual view, right-click on a web site that is being used and select "Properties".
Take note of a "User name: To modify the permissions settings on files and folders, use the Windows Explorer user interface or icacls command. Example 4 Configuring file access permissions. With PHP applications, index.
Right-click on the "Web Sites" node in the tree view and select "Properties". The two settings that control timeouts are ActivityTimeout and RequestTimeout.
PHP searches for php. To instruct PHP to load the configuration file from php installed as cgi binary manual custom location run the command shown below. The absolute path to the directory with php. Example 7 Changing the location of php. For instructions on setting up IIS 5. The steps to enable it php installed as cgi binary manual based on the version of Windows being used. Click "Next" and then "Install" and wait for the installation to complete.
In the "Features View" page open the "Handler Mappings" feature. In the "Add Module Mapping" dialog enter the following: Click "Request Restrictions" button and then configure the mapping to invoke handler only if request is mapped to a file or a folder.
Replace the value of the fullPath parameter with the absolute file path to the php-cgi. Replace the value of the scriptProcessor parameter with the absolute file path to the php-cgi. Example 10 Creating handler mapping for PHP requests. This ensures that even if the same PHP process is shared across different IIS web sites, the PHP scripts in those web sites will not be able to access each other's files as long as different user accounts are used for IIS authentication on each web site.
For example IIS 7, in its default configuration, has anonymous authentication enabled with built-in user account IUSR used as a default identity. If PHP applications need to perform write operations on certain files or write files into some folders then IUSR account should have write permission to those. To determine what user account is used as an anonymous identity in IIS 7 use the following command.
In the output XML configuration element look for the userName attribute. Example 11 Determining the account used as IIS anonymous identity. If userName attribute is not present in the anonymousAuthentication element, or is set to an empty string, then it means that the application pool identity is used as an anonymous identity for that web site. Example 12 Configuring file access permissions. Example 13 Set index. The two settings that control timeouts are activityTimeout and requestTimeout.
Use the commands below to change the timeout settings. Make sure to replace the value in the fullPath parameter to contain the absolute path to the php-cgi. Example 16 Changing the location of php. This section contains notes and hints specific to Apache 1. Please read the manual installation steps first! There are two ways to set up PHP to work with Apache 1.
One is to use the CGI binary php. In either case you need to edit your httpd. It is worth noting here that now the SAPI module has been made more stable under Windows, we recommend php installed as cgi binary manual use above the CGI binary, since it is more transparent and secure. Although there can be a few variations of configuring PHP under Apache, these are simple enough to be used by php installed as cgi binary manual newcomer.
Please consult the Apache Documentation for further configuration directives. Remember that when adding path values in the Apache configuration files on Windows, all backslashes such as c: A trailing slash may also be necessary for directories.
You should add the following lines to your Apache httpd. Example 17 PHP as an Php installed as cgi binary manual 1. This assumes PHP is installed to c: Adjust the path if this is not the case. If you unzipped the PHP package php installed as cgi binary manual C: Example 18 PHP and Apache 1. A server deployed in CGI mode is open to several possible vulnerabilities.
Please read our CGI security section to learn how to defend yourself from such attacks. If you would like to present PHP source files syntax highlighted, there is no such convenient option as with the module version of PHP. To do this simply create a PHP script file and add this code: This section contains notes and hints specific to Apache 2.
You should read the manual installation steps first!