|
Installation for Apache 2.x on Windows systemsThis section contains notes and hints specific to Apache 2.x installs of PHP on Microsoft Windows systems.
It is strongly recommended to consult the » Apache Documentation to get have a basic understanding of the Apache 2.x Server. Also consider reading the » Windows specific notes for Apache 2.x before reading on here. Download the most recent version of » Apache 2.x and a fitting PHP version. Follow the Manual Installation Steps and come back to go on with the integration of PHP and Apache. There are three ways to set up PHP to work with Apache 2.x on Windows. PHP can be run as a handler, as a CGI, or under FastCGI.
Installing as an Apache handler
To load the PHP module for Apache 2.x, the following lines in the Apache httpd.conf configuration file must be inserted: Example #1 PHP and Apache 2.x as handler # before PHP 8.0.0 the name of the module was php7_module LoadModule php_module "c:/php/php8apache2_4.dll" <FilesMatch \.php$> SetHandler application/x-httpd-php </FilesMatch> # configure the path to php.ini PHPIniDir "C:/php"
Running PHP as CGIIt is strongly recommended to consult the » Apache CGI documentation for a more complete understanding of running CGI on Apache. To run PHP as CGI, the php-cgi files will need to be placed in a directory designated as a CGI directory using the ScriptAlias directive.
A Example #2 PHP and Apache 2.x as CGI #!C:/php/php.exe <?php phpinfo(); ?> Warning
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. Running PHP under FastCGIRunning PHP under FastCGI has a number of advantages over running it as a CGI. Setting it up this way is fairly straightforward:
Obtain Configure the web server as shown below, taking care to adjust any paths to reflect how it is installed on the system: Example #3 Configure Apache to run PHP as FastCGI LoadModule fcgid_module modules/mod_fcgid.so # Where is the php.ini file? FcgidInitialEnv PHPRC "c:/php" <FilesMatch \.php$> SetHandler fcgid-script </FilesMatch> FcgidWrapper "c:/php/php-cgi.exe" .php .php extension will now be executed by the PHP FastCGI
wrapper.
|