the Internet Windows Android

PHP Installing on Windows 7. How to install a local APACHE server with PHP, MySQL, phpMyAdmin on a Windows computer

This section of the manual is applicable to Windows 98 / ME and Windows NT / 2000 / XP / 2003. PHP will not work on 16 bit platforms, such as Windows 3.1 and sometimes we refer to the supported Windows platforms like Win32.

Comment:

Windows XP / 2003 is no longer supported for PHP 5.5.0.

Comment:

Windows 98 / ME / NT4 / 2000 is no longer supported for PHP 5.3.0.

Comment:

Windows 95 is no longer supported for PHP 4.3.0.

If you have an environment for design, such as Microsoft Visual Studio, you can also collect PHP from source code.

By installing PHP in Windows, you can also want to download various extensions to provide additional functionality.

Manual installation manual

This section contains instructions for manual installation and PHP settings on Microsoft Windows.

Selection and loading PHP distribution packages

Load the PHP distribution in the form of a zip archive with. There are several different versions of zip-packets - select a version that is suitable for the web server used:

Structure and content of PHP package

Unpack the contents of the ZIP archive into the directory on your choice, for example C: \\ PHP \\. The structure of folders and files extracted from the archive will look like this:

Example # 1 PHP 5 Package Structure

c: \\ PHP | + - Dev | | | | -PHP5TS.LIB - version of php5.lib without supporting multithreading | + - EXT - DLL extensions for PHP | | | | -php_bz2.dll | | | | -php_cpdf.dll | | | | -... | + - Extras - empty | + - PEAR - initial copy of PEAR | | | -Go-pear.bat - PAR installation script | | -... | | -PHP-CGI.exe - executable CGI file | | -php-win.exe - performs scripts without an open console | | -php.exe - executable PHP file for command line (CLI) | | -... | | -PHP.ini-Development - PHP.INI default settings | | -PHP.ini-Production - Recommended settings php.ini | | -php5apache2_2.dll - available only in a multi-threaded version | | -php5apache2_2_filter.dll - available only in a multi-threaded version | | -... | | -PHP5TS.dll - PHP DLL core (php5.dll in version without multithreading) | | -...

The following is a list of modules and executable files included in PHP Zip distribution:

    pHP-CGI.exe is a CGI executable file that can be used during PHP start to IIS via CGI or FastCGI.

    php-win.exe is the PHP executable file to perform PHP scripts without using the console (for example, PHP applications using Windows GUI).

    php.exe is an executable PHP file to perform PHP scripts in the console (CLI).

    php5apache2_2.dll - APACHE 2.2.x module.

    php5apache2_2_filter.dll - Apache 2.2.x filter.

Changing the php.ini file

After the contents of the PHP package is extracted, create a copy of PHP.ini-Production named php.ini in the same folder. If necessary, it is also possible to place PHP.ini anywhere else on your choice, but it will require additional configuration, which is provided in the PHP Settings section.

The php.ini file contains the rules for the execution of PHP and the instructions for working with the environment in which it starts. Below are some of the php.ini settings that can improve the PHP operation in Windows. Some of them are optional. There are many other directives that can be useful in your environment - refer to the list of PHP.ini directives for more information.

Mandatory directives:

    eXTENSION_DIR \u003d. <путь к директории расширений> - Extension_dir indicates a directory where PHP extensions are located. The path can be absolute (for example, "C: \\ PHP \\ EXT") or relative (for example. \\ Ext "). Used in php.ini extensions must be located in Extension_dir.

    extension \u003d. xxxxx.dll - For each plug-in extension, you must specify the "EXTENSION \u003d" directive. Extensions from Extension_dir, marked by such a directive, are loaded at the PHP start.

    log_errors \u003d. ON. - PHP has a mechanism for maintaining a log of errors that can be used to save errors in a file or to send to service (for example syslog). The mechanism also uses the value of the Error_log directive. When PHP is executed by IIS, log_errors must be enabled with the correct ERROR_LOG.

    error_log \u003d. <пусть к файлу лога ошибок> - Error_log is needed to designate the absolute or relative path to the file in which PHP errors are logged. This file should be available for web server recording. The most common places of placement of this file are a different temporary TEMP directory, for example "C: \\ INETPUB \\ TEMP \\ PHP-ErRors.log".

    cgi.force_redirect \u003d. 0 - This directive is necessary for execution under IIS. This is a directory protection mechanism required by many other web servers. However, the inclusion of it under IIS will cause PHP kernel errors in Windows.

    cgi.fix_pathinfo \u003d. 1 - Provides support for PATH_INFO according to the CGI specification. IIS Fastcgi uses this setting.

    fastcgi.impersonate \u003d. 1 - FastCGI under IIS supports the ability to identify the security markers of the caller. This allows IIS to determine the security context that the query is executed.

    fastcgi.logging \u003d. 0 - The FastCGI log entry must be turned off in IIS. If the entry is enabled, then all messages of any classes are recognized by FASTCGI as errors, which will lead IIS to generate an HTTP 500 exclusion.

Optional Directives

    max_execution_time \u003d. ## - This directive indicates the maximum execution time of any PHP script. Default is 30 seconds. It is necessary to increase this value if the PHP application must be performed longer.

    memory_Limit \u003d. ### M. - Number of memory available to PHP process in MB. Default 128, which is enough for most PHP applications. Some complex applications may require more memory.

    display_errors \u003d. Off - Directive determines which errors to return a web server for further logging. With the "ON" value, PHP reports all types of errors that are given in the Error_Rer_Reporting directive. For security reasons, it is recommended to install in "Off" on the working servers to exclude the transfer of error output to the end user, as they may contain information that threatens the application security.

    open_Basedir \u003d. <пути к директориям, разделенные точкой с запятой> , for example OpenBasedir \u003d "C: \\ INETPUB \\ WWWWROOT; C: \\ INETPUB \\ TEMP". This directive specifies the paths to directories in which PHP are permitted with file system operations. Any operation with files and directories outside the specified paths will result in an error. This directive is especially useful to prevent access to the installed PHP in the environments of shared hostings to prevent PHP access to scripts to any files outside the root directory of the web site.

    upload_max_FileSize \u003d. ### M. and post_max_size \u003d. ### M. - Maximum allowed size of the downloaded file and sent data, respectively. The values \u200b\u200bof these directives should be enlarged if PHP applications must process large downloadable files, such as images or video files.

After installing PHP on your system, the next step will be the selection of the web server and its further setting to work with PHP. Select a specific web server in the table of contents to this material.

Microsoft IIS 5.1 and IIS 6.0

This Section Contains Instructions for Manually Setting Up Internet Information Services (IIS) 5.1 and IIS 6.0 to Work with PHP on Microsoft Windows XP and Windows Server 2003. For Instructions on Setting Up IIS 7.0 and Later Versions on Windows Vista, Windows Server 2008, Windows 7 and Windows Server 2008 R2 Refer to Microsoft IIS 7.0 and Later.

Configuring IIS to Process PHP Requests

Download and Install PHP in Accordance to the Instructions Described in Manual Installation Steps

Comment:

Non-Thread-Safe Build of PHP IS RECOMMENDED WHEN USING IIS. The Non-Thread-Safe Builds Are Available At

Configure The CGI- and Fastcgi-Specific Settings in PHP.ini File As Shown Below:

Example # 2 CGI and Fastcgi Settings in php.ini

Enabling FastCGI support in IIS

The FastCGI module when installing IIS is disabled by default. Methods for switching on it differ depending on the version of the Windows used.

To enable FASTCGI support on Windows Vista SP1 and Windows 7:

    In the "Start" menu, select "Run", in the window that appears, enter from the "OptionalFeatures.exe" keyboard and click "OK";

    In the Windows Components window that opens, expand the "IIS" service, "Internet service", "application development components" and install a check mark in front of "CGI";

    Click OK and wait for the installation process.


To enable FASTCGI support on Windows Server 2008 and Windows Server 2008 R2:

    In Windows, open the Start menu, select "Run:", type from the keyboard "COMPMGMTLAUNCHER" and click "OK";

    If the role of "Web Server (IIS)" is not represented in the "Roles" tab, add it by selecting "Add Roles";

    If the role of "Web Server (IIS) is present, select" Role Selection "and check the box next to the" CGI "in the" Application Development Components "group;


IIS Setup for PHP Request Processing

Download and install PHP in accordance with the instructions given in the installation description.

Comment:

Change CGI and FASTCGI settings in the php.ini file as shown below:

Example # 8 CGI and Fastcgi settings in php.ini

fastcgi.impersonate \u003d 1 fastcgi.logging \u003d 0 cgi.fix_pathinfo \u003d 1 cgi.force_redirect \u003d 0

Set the IIS handler for PHP using the IIS control interface or via the command line.

Using IIS Management Interface to create PHP handler

The following steps will allow you to create an IIS handler for PHP in the IIS control interface:



Using the command line to create a PHP handler comparison

Use the commands below to create an IIS Fastcgi processes that will use PHP-CGI.exe performed for PHP requests. Replace the value of the FullPath parameter to the absolute path to the php-cgi.exe file.

Example # 9 Creating IIS Fastcgi Process Pool

% WINDIR% \\ System32 \\ inetsrv \\ appcmd set config /section:system.webserver/fastcgi ^ / +

The IIS setting for processing specific PHP queries from the command line is shown below. Replace the value of the scriptProcessor parameter to the absolute path to the php-cgi.exe file.

Example # 10 Creating PHP Request Processor

% WINDIR% \\ System32 \\ inetsrv \\ appcmd set config /section:system.webserver/handlers ^ / +

This command creates a handler comparison for IIS for files with the * .php extension, which is obtained as a result and processed by the FastCGI module.

Comment:

At this step, the installation and configuration is completed. The following instructions are optional, but highly recommended to achieve optimal functionality and PHP performance on IIS.

View and access to the file system

When using IIS, it is recommended to enable the FastCGI view in PHP. This is controlled by the Fastcgi.impersonate directive in php.ini file. When the impersonation is enabled, PHP will perform all operations with the file system under the account that was defined when IIS authentication. This ensures that with the general PHP process for all IIS sites, PHP scripts of these sites will not have access to each other files until IIS uses various accounts for each site.

For example, in default settings IIS 7, anonymous authentication is enabled under the standard IUSR user. This means that giving the IIS permission to perform the PHP script, it is also necessary to give the right to read this script to the IUsr account. If the PHP application needs to record in some files or folders, then the IUsr account should be given the right to record in them.

To decide which user is used to identify in IIS 7, you can use the following commands. Replace "Default Web Site" in the name of the IIS site with which you are working. At the output, in XML configuration, see the username attribute.

Example # 11 Definition of an Account used by IIS with anonymous identification

% WINDIR% \\ System32 \\ inetsrv \\ appcmd.exe list config "default web site" ^ / Section: anonymousauthentication

Comment:

If the username attribute is missing in the AnonymousAuthentication element, or installed as an empty string, it means that the application pool certificate is used as an anonymous for this website.

To change access settings for files or folders, use the user interface in Windows Explorer or the ICACLS command.

Example # 12 Setting up access to file access

icacls c: \\ inetpub \\ wwwroot \\ upload / grant iusr: (oi) (Ci) (M)

Installing index.php as default document in IIS

By default, IIS is not set to the name of the default HTTP requests. In PHP applications, the default Index.php document is usually used. To add index.php to the default IIS document, use the following command:

Example # 13 Installing index.php as default document in IIS

% WINDIR% \\ SYSTEM32 \\ INETSRV \\ APPCMD.EXE SET CONFIG ^ -SECTION: System.WebServer / DefaultDocument / + "Files." ^ / COMMIT: Apphost

FastCGI and PHP configuration with processes

Setting up IIS FastCGI settings for the disposal of PHP processes using commands is shown below. The Fastcgi InstanceMaxRequests option sets the maximum number of queries that can be processed with one PHP-CGI.exe process until IIS will not start disable them. PHP Environment Variable PHP_FCGI_MAX_Requests Sets as many requests to process one PHP-CGI.exe process until it starts to delete them. Of course, the value set for Fastcgi InstancemaxRequests is less than or equal to php_fcgi_max_requests.

Example # 14 Setup FastCGI and PHP Peresoscast

% WINDIR% \\ SYSTEM32 \\ INETSRV \\ APPCMD.EXE SET CONFIGSETION: System.Webserver / Fastcgi ^ /.instancemaxRequestS: 0000% windir% \\ System32 \\ inetsrv \\ appcmd.exe set config -section: System.Webserver / Fastcgi ^ / + ". EnvironmentVariables. ^"

Installation of Taimaut Fastcgi.

Increasing the timeout parameter for FastCGI is done if there is a long PHP script. Two parameters control the timeout, it is: ActivityTimeout and RequestTimeout. Use the commands below to change the timaout settings. Of course, you need to replace the value of the FullPath parameter for the full path to the php-cgi.exe file.

Example # 15 FastCGI Timeout Installation Configuration

% WINDIR% \\ SYSTEM32 \\ INETSRV \\ APPCMD.EXE SET CONFIGSETION: System.WebServer / Fastcgi ^ /.Tebserver / Fastcgi ^ /.activityTimeout: "/ COMMIT: Apphost% WinDir% \\ System32 \\ inetsrv \\ appcmd.exe set config -section: SYSTEM .webserver / fastcgi ^ /.RequestTimeout: "90 "/ COMMIT: Apphost

Changing the position of the php.ini file

There are two methods for setting PHP to work with Apache 1.3.x in Windows. The first is to use the CGI binary file (php.exe for PHP 4 and PHP-CGI.exe for PHP 5), the second is to use Apache Module DLL. In both cases, it is necessary to deflate httpd.conf to configure Apache to work with PHP and restart the server.

Currently, SAPI module is more stable under Windows, so we recommend using it instead of CGI as it is more transparent and safe.

Although there are several options for configuring PHP under Apache, they are simple enough for a beginner. Please use Apache documentation for further configuration instructions.

Do not forget to restart the server after changing the configuration file. For example, teams Net Stop Apache. and Net Start Apache.If Apache is running as a Windows service, or using ordinary shortcuts.

Comment:

Installing PHP as Apache module

You must add the following rows to the Apache file httpd.conf:

Example # 17 PHP as an Apache 1.3.x module

This assumes that PHP is set to C: \\ PHP. Change the way if it is not.

# Add to the end of the loadmodule section # don "t forget to copy this file from the sapi directory! Loadmodule php4_module" c: /php/php4apache.dll "# Add to the End of the AddModule Section AddModule mod_php4.c

# Add to The End of the LoadModule Section LoadModule PHP5_Module "C: /PHP/PHP5APACHE.DLL" # Add to the End of the AddModule Section AddModule mod_php5.c

For both versions:

# Add This Line Inside The Conditional Brace AddType Application / X-Httpd-Php .php # for Syntax HighlightD.PHPS Files, Also Add AddType Application / X-Httpd-PHP-Source .phps

Installation as a binary CGI file

If PHP is unpacked in C: \\ PHP \\ as described in the Manual Installation Steps section, you must add the following rows to the Apache configuration file:

Example # 18 PHP and Apache 1.3.x as CGI

Note that the second line in the list above is already in httpd.conf, but it is commented. Also, do not forget to replace C: / PHP / on your real path to PHP.

Attention

"Security CGI"

In the case of PHP installation as CGI, there is no such convenient option to highlight the PHP source syntax syntax as when installed as a module. If you want to use it, you must use the function highlight_File (). To do this, simply create a php script with the following code: .

Apache 2.x ON Microsoft Windows

This section contains instructions for installing PHP for Apache 2.x on Microsoft Windows systems.

Comment: Support Apache 2.2.

Apache 2.2 users should pay attention to the fact that the DLL file for Apache 2.2 is called php5apache2_2.dll, and not php5apache2.dll and it is available only for PHP 5.2.0 and later.

It is highly recommended to familiarize yourself with the Apache documentation to get the basic knowledge about Apache 2.x Server. Also, before reading this reference, pay attention to "recommendations for Windows by Apache 2.x.

Apache 2.x is designed to work in Windows Server versions, such as Windows NT 4.0, Windows 2000, Windows XP or Windows 7. Although Apache 2.x can be used on Windows 9x, these platforms are not fully supported, and some functions will not work. right. The correction of this situation is not planned.

Download the most relevant version of Apache 2.x and the appropriate PHP version. Follow the Step-by-Step Installation Guide and return to continue the integration of PHP and Apache.

There are three PHP installation paths for Apache on Windows. You can run PHP as a handler as CGI, or under FastCGI.

Comment: Remember that when specifying ways in Apache configuration files under Windows, all reverse stuck, for example, C: \\ directory \\ file.ext should be changed to direct: C: /Directory/File.Ext. For ways with directories, you may also need to slant at the end.

Installing PHP as an Apache handler

You need to add the following rows to your Apache configuration file httpd.conf to load a PHP module for Apache 2.x:

Example # 19 PHP as an Apache 2.x handler

# LoadModule PHP5_Module "C: /PHP/PHP5APACHE2.dll" Addhandler Application / X-Httpd-PHP .php # Configuring the path to php.ini phpinidir "C: / PHP"

Comment: Do not forget to specify the current path to the PHP directory instead of C: / PHP / in the example above. Take care so that in the LoadModule directive either the php5apache2.dll or php5apache2_2.dll and make sure that the specified file is actually on the path that you indicated in the directive.

The above configuration will allow PHP to process any file that has an extension. PHP, even if there are other extensions. For example, the file with the example.php.txt will be launched by PHP handler. To ensure that only files that have an extension .php will be running, use the following configuration:

SetHandler Application / X-Httpd-PHP

Run PHP as CGI

You must refer to the documentation »Apache CGI for a more complete understanding of the start of CGI under Apache.

To start PHP as CGI, you need to place your PHP-CGI files into the directory, designated as the CGI directory using the Scriptalilas directive.

After that you need to add a string #! In PHP files indicating the location of the PHP executable file.

Example # 20 PHP as CGI under Apache 2.x

#! C: /PHP/php.exe

Attention

Using the CGI installation, your server is open before several possible vulnerabilities. Please check out the CGI Security section to find out how to protect yourself from such attacks.

Run PHP under Fastcgi

The PHP start under FastCGI has a number of advantages compared to running as CGI. Installation is quite simple:

NSAPI SETUP ON SUN, IPLANET AND NETSCAPE SERVERS

To install php with nsapi, do the favoring:

  • Copy php4ts.dll to your SystemRoot (The Directory Where You Installed Windows)
  • Make a File Association from the Command Line. Type The Following Two Lines:

    assoc .php \u003d phpscript ftype phpscript \u003d C: \\ php \\ php.exe% 1% *

  • In The Netscape Enterprise Administration Server Create A New Mime Type (Category: Type, Content-Type: Magnus-Internal / X-Httpd-PHP, File Suffix: PHP).
  • Edit Magnus.conf (for Servers\u003e \u003d 6) or Obj.conf (for Servers< 6) and add the following: You should place the lines after mime Types init.

    Init fn \u003d "load-modules" funcs \u003d "php4_init, php4_execute, php4_auth_trans" shlib \u003d "c: / php/sapi/php4nsapi.dll" init fn \u003d "php4_init" lateinit \u003d "yes" errorstring \u003d "Failed to initialise php! "

    (Php\u003e \u003d 4.3.3) The php_ini. Parameter Is Optional But It You Can Place Your Php.ini in Your Web Server Configuration Directory.

    Configure The Default Object in Obj.conf (for Virtual Server Classes In Their VServer.obj.conf): In The section, place this line necessarily after all "ObjectType" and before all "AddLog" lines:

    Service fn="php4_execute" type="magnus-internal/x-httpd-php"

    (PHP >= 4.3.3) As additional parameters you can add some special php.ini -values, for example you can set a docroot="/path/to/docroot" specific to the context php4_execute is called. For boolean ini-keys please use 0/1 as value, not "On","Off",... (this will not work correctly), e.g. zlib.output_compression=1 instead of zlib.output_compression="On"

    This is only needed if you want to configure a directory that only consists of PHP scripts (same like a cgi-bin directory):

    ObjectType fn="force-type" type="magnus-internal/x-httpd-php" Service fn=php4_execute

    After That You Can Configure A Directory in the Administration Server and Assign It The Style x-HTTPD-PHP. All Files in It Will Get Executed AS PHP. This is nice to hide php usage by renaming files to .html.

  • Restart Your Web Service and Apply Changes
  • Do it for Each Web Server Instance You Want PHP to Run
  • Comment:

    The Stacksize That Php Use Depends on The Configuration of the Web Server. If You Get Crashes with Very Large PHP Scripts, IT IT Recommended to Raise IT with The Admin Server (in the section "Magnus Editor").

    CGI Environment and Recommended Modifications in php.ini

    Important When Writing PHP Scripts Is The Fact That Sun JSWS / SUN One WS / Iplanet / Netscape Is a MultithReaded Web Server. Because of the All Recuests Are Running In The Same Process Space (The Space of the Web Server Itself) And this Space Has Only One Environment. If You Want to Get CGI Variables Like Path_info., Http_host. ETC. IT IS NOT THE CERRECT WAY TO TRY THIS IN THE OLD PHP WAY WITH getenv () Or a Similar Way (Register Globals to Environment, $ _Env). You Would Only Get The Environment of the Running Web Server Worthout Any Valid CGI Variables!

    Comment:

    Why Are there here (invalid) CGI VARIABLES IN THE ENVIRONMENT?

    Answer: This is Because You Started The Web Server Process from the Admin Server Which Runs The Startup Script of the Web Server, You Wanted to Start, As A CGI Script (A CGI Script Inside of the Admin Server!). This Is Why The Environment of the Started Web Server Has Some CGI Environment Variables in It. You can Test this by Starting The Web Server Not From the Administration Server. Use the Command Line As Root User and Start It Manually - You Will See There Are No Cgi-Like Environment Variables.

    Simply Change Your Scripts to Get CGI Variables In The Correct Way for PHP 4.x by Using the Superglobal $ _Server. If You Have Older Scripts Which $ http_host, etc., You Should Turn ON register_globals. IN PHP.INI AND CHANGE THE VARIABLE ORDER TOOO (Important: Remove "E" From It, Because You Do Not Need The Environment Here):

    variables_order \u003d "gpcs" register_globals \u003d ON

    Special Use for Error Pages or Self-Made Directory Listings (php\u003e \u003d 4.3.3)

    You can USE PHP to Generate The Error Pages for "404 NOT FOUND" or similar. Add The Following Line To the Object in Obj.conf for Every Error Page You Want to Overwrite:

    ERROR FN \u003d "PHP4_EXECUTE" Code \u003d xxx script \u003d "/ path / to / script.php"

    Where Xxx IS The HTTP Error Code. Please Delete Any Other Error Directives Which Could Interfere with Yours. If You Want To Place A Page for All Errors That Could EXIST, Leave The code. Parameter Out. Your Script Can Get The Http Status Code with $ _Server ["error_type"].

    Another Possibility is to Generate Self-Made Directory Listings. Just Create A PHP Script Which Displays A Directory Listing and Replace The CRESPONDING DEFAULT SERVICE LINE FOR type \u003d "Magnus-Internal / Directory" In Obj.conf with the favoring:

    Service FN \u003d "PHP4_EXECUTE" Type \u003d "Magnus-Internal / Directory" script \u003d "/ path / to / script.php"

    For Both Error and Directory Listing Pages The Original Uri and Translated URI ARE IN THE VARIABLES $ _SERVER ["PATH_INFO"] AND $ _SERVER ["PATH_TRANSLATED"].

    This list describes the installation of an ISAPI module to work with the Sambar server under Windows.

      Find the file called Mappings.ini (in the Config folder) in the SAMBAR installation directory.

      Open Mappings.ini and add the following line under :

      Example # 22 ISAPI configuration for sambar

      #for PHP 4 * .php \u003d C: \\ php \\ php4isapi.dll #for php 5 * .php \u003d C: \\ php \\ php5isapi.dll

      (If PHP is set to C: \\ PHP.)

      Restart Sambar to change the changes to take effect.

    Comment:

    If you want to use PHP to communicate with resources on other computers of your network, you need to change the account that is used by the SAMBAR server. By default, this Localsystem and deleted resources will be unavailable. The account can be edited using the Administration Utility from the Windows Control Panel.

    Xitami on Microsoft Windows

    This section contains notes and tricks specific to "Xitami on the Windows platform.

    This list of actions describes how to install PHP CGI library so that it worked with Xitami under Windows.

    Comment: IMPORTANT FOR CGI Users

    Install PHP extensions in Windows

    After installing the PHP and the web server on Windows, you may need to set some extensions to add functionality. You can choose which extensions will be loaded at the PHP start, modifying your php.ini file. You can also download extensions dynamically in your scripts using a function.

    We specify the version of your operating system (I specified 64-bit Windows), and go to the download page (go to download https://dev.mysql.com/downloads/windows/installer/5.7.html).

    I chose the full MSI installer download. At the time of writing this note was the current version of MySQL 5.7.21, and the distribution was downloaded by the name Mysql-Installer-Community-5.7.21.0.msi.

    Apache 2.4.

    At the time of preparation of the article, X64 version 2.4.33 was available, assembled on the basis of VC14:
    httpd-2.4.29-o110g-x64-vc14.zip.
    The size of the archive is about 10 MB.

    PHP 7.2.

    At the time of preparation of this article, X64 version PHP 7.2 (7.2.2), Thread Safe collected on VC15: PHP-7.2.2-WIN32-VC15-X64.zip was available.
    Zip archive size: 24 MB.
    Now there are also ponay.

    phpmyAdmin (PMA)

    To manage MySQL databases on a local computer, install a free PHPMYAdmin package.

    I download it from the site http://www.phpmyadmin.net/
    At the time of preparation, version 4.7.7 was available:
    phpmyAdmin-4.7.7-All-Languages.zip.
    Size - about 11 MB.

    The contents of the archive are postponed in a pre-harvested folder, for example:
    D: \\ Sites \\ Localhost \\ www

    List for installation

    Distributions downloaded. Install in this order:

    • Mysql
    • Apache - Configure Virtual Servers, check on HTML
    • PHP - With additional adjustment Apache check on PHP_TEST.php
    • phpmyAdmin (with additional PHP setting)

    Installing MySQL

    We start the previously downloaded mysql installer (MySQL-Installer -.... MSI).

    In the License Agreement window, we set a tick in the paragraph:
    I Accept the License Terms
    - And click the Next button.

    In the Choosing A Setup type window, select Custom (to select the parameters for installing the MySQL server). Click the Next button.

    In the component selection window (Select Products and Features), we must select the MYSQL Server component - x64. The remaining components are optional. By selecting the component on the left side of the window, press the arrow to the right so that this component from the available installation switched to the right-hand side of the window is a list of what we will install.

    Click Next after selecting components.

    In the Installation window, click the Execute button to start the installation.

    You can watch the installation under the installation by clicking the Show Details button.

    When the installation is complete (Status becomes Complete), press the Next button to go to configuring the MySQL server.

    In the Product Configuration window, press the NEXT button.

    In the Type and Networking window

    we leave the Standalone MySQL Server item, click Next.

    In the next Type and Networking window
    Install CONFIG TYPE \u003d Development Machine

    TQKA TCP / IP and Open Firewall Port For Network Access points are left.
    MYSQL communication port is also left with the default value (Port number \u003d 3306).

    Install the Show Advanced Options Point.

    In the Accounts and Roles window, set a password for the main user (with the root - administrator login).

    In the MySQL User Accounts field, you can add other users who will have access to MySQL databases. We will not create other other things: we will connect as root.

    In the Windows Service window, leave a daw at the Configure MySQL Server AS AS AS service item (so that the MySQL server is started as a system service).

    The system service name (MYSQL57) will leave the default.

    To run the MySQL server service, we will manually (it only needs it for the development and testing time of local sites), so remove the checkbox at the Start The MySQL Server AT System Startup (so that the server does not start every time you start OC Windows).

    We will run the service on behalf of Standard System Account (do not change this option).

    In the Plugins and Extensions window, leave everything as it is. Click Next.

    In the Advanced Options window, you can change the log parameters (logs), where the server writes messages during its work. Here you can leave everything as it is.

    In the Apply Configuration window, click the Execute button to apply the server configuration.

    After completing the FINISH button.

    In the ProDuct Configuration window, click Next.

    In the last Installation Complete window, the values \u200b\u200bcan not be installed. Click FINISH.

    Installing and configuring MySQL server is over.

    You can start / stop the MySQL server by clicking on Windows List.
    Find in the MySQL57 list, right-click on it and select "Run / Stop".

    Installing Apache 2.4 for Windows

    There are many articles on the Internet, where it is described how Apache 2.4 is installed for Windows. I, maybe, and I repeat something, but I will describe my version step by step.

    In the archive downloaded from the developer's site (used version httpd-2.4.29-o110g-x64-vc14.zip), there is a Apache24 folder. Her, along with its contents, put on a disk with:

    In addition to the package itself (Apache24 folders), the archive lies the readme_first.html file, which is useful to read.

    Special attention should be paid to the presence of Visual C ++ 2015 X64 Redistributable Package package in the Windows installed.
    This package contains a set of libraries, without which this Apache assembly will not work.
    Download free This package can be from the Microsoft site, by reference (https://www.microsoft.com/en-us/download/details.aspx?id\u003d49984) given in the file readme_first.html. Be sure to install it if it is not yet in your OS.

    If programs are installed on your computer, listening to 80 port, then it is better to double them from using this port, or appoint them another. The default APACHE server is configured to this port, see the Listen parameter in the file C: \\ Apache24 \\ CONF \\ httpd.conf

    We try to start the server (later consider the option of starting the server as a system service (service)).
    To do this, run the command line in (on behalf of) administrator.
    Go to the folder C: \\ Apache24 \\ Bin and launch the httpd.exe program

    When you first start, you can notify the Windows security system that Windows Firewall has blocked some functions of this application (see Figure)

    We put a tick allowing Apache HTTP Server communication for private networks.
    Work in public networks can be prohibited.

    Opening any browser, enter the address http: // localhost /
    - The collector page of this Apache server must appear.

    (It is installed with a package installed in the folder C: \\ Apache24 \\ Htdocs - this value has a Documentroot variable in the httpd.conf file,
    But we will change it later).

    So, the Apache server starts and works fine.

    If the server does not start, then you need to see what mistakes it gives. Errors can be seen at startup: on the command prompt and in the file C: \\ Apache24 \\ Logs \\ Error.log

    We now make it so that the Apache server is run by the service (described in README_FIRST.HTML, attached to the distribution).
    In the command prompt, running on behalf of the administrator, by clicking on the C: \\ Apache24 \\ Bin folder, start the command
    httpd -k install

    To track the state of the APACHE server service and perform it to restart (we often do it in the course of the setting) conveniently through the C: \\ Apache24 \\ Bin \\ ApacheMonitor.exe program. Make a label for it and place it in a convenient place to start (in the taskbar or on the desktop).

    It remains to configure the Apache server for our needs:
    orient to folders in which our sites will lie;
    Prepare for work with MySQL and PHP.

    Suppose we wish to have on the local computer while 2 sites with the names of Localhost and WP-Test
    http: // localhost /
    http: // WP-TEST /

    To do this, in the system file C: \\ Windows \\ System32 \\ Drivers \\ ETC \\ HOSTS should be such lines

    127.0.0.1 Localhost.
    127.0.0.2 WP-TEST

    The first line usually already exists by default.
    Secondly scroll on your own.

    These rows report that the hosts with the LocalHost and WP-TEST names must be signed by IP addresses 127.0.0.1 and 127.0.0.2.
    - both addresses comply with the local computer.

    Restart OS is optional.

    Create a folder on the local computer for storing site files, for example in the folder:
    D: \\ Sites \\ Localhost
    D: \\ Sites \\ WP-TEST

    In each of these folders, create 2 files with names
    Access.log.
    error.log.
    and subfolder www.
    D: \\ Sites \\ Localhost \\ www
    D: \\ Sites \\ WP-Test \\ www
    - In these folders, create index.html files with such content:
    This is Localhost.
    This WP-TEST

    Now you will configure the Apache server to use virtual hosts that meet our sites.

    Edit the server configuration file (C: \\ Apache24 \\ CONF \\ httpd.conf).
    To do this, it must be opened in a text editor.
    For this I use NotePad ++ (a very multifunctional free editor).

    Virtual hosts usually prescribe at the end of this file.

    Add such lines there:

    #LocalHost. ServerName Localhost Documentroot "D: / SITES / Localhost / WWW" ErrorLog "D: /Sites/localhost/error.log" CustomLog "D: /Sites/localhost/Access.log" Common # WP-Test ServerName WP-Test Documentroot "D: / SITES / WP-TEST / WWW" ErrorLog "D: /Sites/wp-test/error.log" CustomLog "D: /Sites/wp-test/Access.log" Common ALLOWOVERRIDE ALL OPTIONS INCLUDES FOLLOWSYMLINKS REQUIRE ALL GRANTED

    We check whether page browsers are opened at addresses
    http: // localhost /
    http: // WP-TEST /

    During the normal opening, the page must display such lines:
    This is Localhost.
    and
    This WP-TEST

    Similarly, you can create other virtual web servers on the local computer.

    Additional settings for Apache, which can be useful.

    Installing PHP 7.

    The contents of the downloaded archive php-7.2.2-win32-vc15-x64 are postponed to the folder C: \\ PHP \\

    Carefully read the file C: \\ php \\ install.txt from the distribution.
    In this file, it is briefly described how to install PHP in the system and configure it to work with Apache.

    Path C: \\ PHP add to the PATH system variable

    For PHP testing on our local site http: // localhost /
    Create in its folder (D: \\ Sites \\ Localhost \\ www) file php_test.php with such content:

    Then, when you open the address http: //localhost/php_test.php, a page with data from the PHPINFO command should be opened.

    Prepare Apache to work with PHP

    In the httpd.conf file

    In the place where modules are loaded (look for a group of LoadModule commands), at the end of the group (if there is no such line) add:

    LoadModule PHP_Module "C: /PHP/PHP7APACHE2_4.dll"

    We specify the path where PHP is installed, directive:

    Phpinidir "C: / PHP"

    In the section Add index.php:

    DirectoryIndex index.html index.php.

    In the section Where the teams like AddType Application ...

    add a string

    AddType Application / X-Httpd-PHP .php

    Save httpd.conf and restart Apache.

    After that, the http test page: //localhost/php_test.php will open.

    Edit the PHP settings file to work phpMyadmin and not only.

    PHP.INI-PRODUCTION file is renamed in php.ini (leave in the same folder C: \\ PHP \\)

    Edit php.ini TA

    We unconsume the string

    EXTENSION_DIR \u003d "EXT"

    Include the parameter (default \u003d OFF)

    Enable_dl \u003d ON.

    We specify the folder to download temporary files

    Upload_tmp_dir \u003d "D: / SITES / UPLOADTEMP" Upload_max_FileSize \u003d 500m

    In chapter; Dynamic Extensions;

    we unconsume lines:

    EXTENSION \u003d GD2 EXTENSION \u003d MBSTRING EXTENSION \u003d MYSQLI

    Include another extension:

    Extension \u003d OpenSSL.

    In order to, for example, update WordPress plugins on the local site through the admin. Otherwise, it turns out an error: no working transports found.

    To perform long scripts, we will prolong the maximum time for their execution, for example, as follows:

    Max_execution_time \u003d 300.

    Installing phpMyadmin.

    By downloading the distribution and posting its contents in the D: \\ Sites \\ Localhost \\ www folder
    Go to the folder with the documentation \\ www \\ doc \\ html and open the setup.html file

    Following his instructions, create a Config subfolder in the root directory (WWW) (this is needed by the phpMyAdmin configuration time, which can be started by opening the configuration page at http: // localhost / setup /).
    Rename the file \\ www \\ config.sample.inc.inc.php in the root directory
    to the working file \\ www \\ config.inc.php
    - This file will be opened to edit and determine the $ CFG ["Blowfish_secret"] parameter - filling out by any characters, for example, by the any_what_you_want phrase:

    $ CFG ["blowfish_secret"] \u003d "any_what_you_want"; / * You Must Fill in This for Cookie Auth! * /

    and, saving, close this file.

    Check if the site pages opens:
    http: // localhost /
    http: //localhost/index.php.

    A lot of good applications are written on PHP. Even no,
    A lot and some of them are very good, so why not use these
    Windows applications? Especially if the internal portal works on Windows, and
    On the Unix car spinning the external site of the company - then
    You can save on the infrastructure and place on Windows
    The server is also an external site. Either if there is a desire to standardize
    Infrastructure and place sites on windows
    platform because developers and users work on
    Windows platform.
    On the site www.iis.net.
    Can be found
    list
    Popular php applications
    With Installation Instructions for IIS. For their launch
    IIS does not need to change
    Php code.

    Installing and configuring PHP for use with FastCGI module.

    To begin with, to successfully use PHP on
    Windows, it would be nice PHP
    Install.
    Step 1. Download PHP
    On the php.net website you need to download
    The last version of PHP for Windows. For use with FastCGI recommended
    Install PHP version without security security control, since the module itself
    FastCGI ensures that execution occurs in one stream and support
    Flow security controls in PHP itself introduces extra checks and
    Locks leading to a significant drop in performance. therefore
    Select non-Thread-Safe Win32 Binaries (version 5.2.6 is relevant at the time of writing
    This message) .
    It is worth noting that we believe Non-Thread-Safe was designed specifically for
    work with FASTCGI on IIS (the first release was in version 5.2.1) and use in
    Other environments are not recommended. By the way, starting with version 5.2.2 Zend seriously
    It works on PHP performance optimization under Windows, which cannot but
    please If you compare version 5.2.1 and 5.2.2, then the difference in the processing speed
    Requests can be easily seen using a simple load test.
    Step 2. Installing PHP
    Installation is completely simple: as we downloaded the archive with
    executable files, it is enough to deploy this archive, for example, in
    Directory C: \\ Web \\ PHP.
    As a basic configuration, we use the recommended installations:
    I have come a copy of the php.ini-recommended file in php.ini in the same directory and open
    It is for editing, after which the file is passing the following
    Rows in order to ensure safety and compatibility with most PHP
    Applications:
    • open_Basedir \u003d. directory where PHP applications are located.
      Specifying the directory limits the rights of access to PHP files only
      This directory. It is convenient to override this setting in the configuration files.
      directly for each application, but it does not prevent this
      Setting and specify the root directory of all PHP applications. For example, C: \\ inetpub \\ phpsites.
    • cGI.Force_Redirect \u003d 0.
      The default is 1, but it is necessary to install in 0, since IIS
      Controls the security of PHP execution and in this setting no
      need. Moreover, the inclusion can lead to unexpected
      Results. When used with other Web servers on Windows this
      Setup must be enabled.
    • cgi.fix_pathinfo \u003d 1.
      PHP will set the file name in the Script_FileName variable if
      set the value 0, then the file name will be in the path_translated variable, which
      may disrupt compatibility with most applications.
    • fastcgi.impersonate \u003d 1;
      FASTCGI allows the process to be impersonated using the client context,
      Causes process. This mechanism works only under FASTCGI / IIS, for example
      On the Apache on Windows it will not work.
    • short_open_tag \u003d ON.
      Most applications use short tagstherefore it will not
      More enable their support.
    • display_errors \u003d ON.
      At the time of checking and debugging PHP applications on FastCGI it is worth the conclusion
      Error messages.
    Step 3. PHP performance check
    While we did not configure IIS, check the performance of the interpreter
    You can simply, for example, by running the C: \\ Web \\ PHP \\ php.exe -info\u003e C: \\ Test.txt

    Installing and configuring the FASTCGI module on IIS7.

    If you have iis7, then something tells me about the name of your operating room
    Systems - Windows Vista? Did not guessed, then Windows Server 2008! Either you hacker and
    put iis7 even somewhere, but this is a non-standard solution and we are not
    Support;).
    Step 1. Installation FastCGI
    I want to refress right away - in IIS7, coming with Windows Server 2008 and Windows Vista
    Service Pack 1 FastCGI module is already enabled. It is only necessary to connect to
    settings. To do this, you need to open Control Panel on Vista -\u003e Programs and choose
    "Turn Windows Features On or Off":

    After that, you need to establish a feature in IIS: Internet Information Services
    -\u003e World Wide Web Services -\u003e Application Development Features -\u003e CGI. Wherein
    Support and CGI and FASTCGI will be installed.

    On Windows Server 2008, the process is similar: Server Manager -\u003e Roles -\u003e Add
    ROLE SERVICES -\u003e Web Server -\u003e Application Development -\u003e CGI.
    Actually everything that is required to turn on the FastCGI module.
    Step 2. IIS7 configuration
    1. Open IIS Manager, select the node (server) for which you need to configure
    PHP support. And then select Handler Mappings.

    2. Select on the Handler Mappings page Add Module Mapping Link and
    Fill in the window with the following values:
    Request Path: * .php (processing all files with extension.php)
    Module: Fastcgimodule (FastCGI module)
    Executable: C: \\ Web \\ PHP \\ php-cgi.exe (PHP path)
    Name: PHP (name for convenience)

    After adding this setting, a window will appear with registration question.
    Fastcgi applications for this handler. I confirm.
    The actions described above led to the creation in the phpsites directories of the following
    Web.config file:


    < configuration >
    < system.webServer >
    < handlers >
    < add name =«PHP» path ="*.php" verb ="*"
    Modules \u003d "Fastcgimodule" scriptProcessor \u003d "C: \\ Web \\ PHP \\ php-cgi.exe"
    ResourceType \u003d "unsypecified" /\u003e



    Now you can proceed to check the performance of PHP.
    Step 3. Check the correctness of the settings
    In the node directory for which we configured PHP create a file
    index.php:
    phpinfo ();
    ?>
    And contact this file via http query. As a result, if everything is fine and
    Our karma is not spoiled, the request will be processed correctly:

    Of course, when using PHP on
    IIS7 may occur underwater stones with which you need
    Fight to achieve the expected result (wonderful work
    PHP applications on windows).
    Hammers for breaking frequently encountered stones are shown below.

    PHP Restart Frequency

    Since when using PHP on
    IIS7 using FastCGI
    module, the FastCGI module itself takes
    Process and resource management, it is necessary to make sure that the restart mechanism
    Processes (Recycling) in PHP
    It will not interfere with FastCGI. It's easy to do if
    configure Fastcgi so that it always restart
    Processes earlier than PHP will do.
    In the FastCGI settings there is a setup
    InstancemaxRequests, determining after processing which quantity of requests,
    The process will be restarted. In php similar parameter
    Sets the value of the PHP_FCGI_MAX_REQUESTS variable. Obviously to give
    The possibility of FastCGI steer the process is enough
    Installation instancemaxrequests<= PHP_FCGI_MAX_REQUEST.
    It is convenient to do, edited by file
    ApplicationHost.config (hides in the C: \\ Windows \\ System32 \\ inetsrv \\ Config \\ directory).
    The configuration must be the following information:

    < fastCgi >
    < application fullPath \u003d "C: \\ inetpub \\ php \\ php-cgi.exe"
    maxInstances \u003d "4" instancemaxrequests \u003d "10000"\u003e
    < environmentVariables >
    < environmentVariable name =«PHP_FCGI_MAX_REQUESTS» value =«10000» >


    Using multiple PHP versions

    Since different PHP versions can be used in
    applications that are posted on the server, it would be good to let
    Use different versions for different sites.
    In the applicationhost.config configuration file
    It is enough to define sections for different versions of PHP:
    < fastCgi >
    < application fullPath \u003d "C: \\ inetpub \\ php \\ php-cgi.exe">
    ...

    < application fullPath =«C:\inetpub\php4\php4.exe» >
    ...

    < application fullPath \u003d "C: \\ inetpub \\ php41 \\ php41.exe">
    ...


    * This Source Code Was Highlighted With.
    And already for each site, a module is configured using one or another
    version (you can use the interface that is described above, and you can
    Edit configuration in the text):
    < handlers >
    < add name =«PHP4» path ="*.php" verb ="*" modules =«FastCgiModule»
    scriptprocessor \u003d "C: \\ inetpub \\ php \\ php41.exe"
    ResourceType \u003d "unsypecified" /\u003e

    * This Source Code Was Highlighted With.

    Using different settings PHP

    If there is a desire to configure PHP differently for
    different sites, then again all this can be described through configuration settings in
    applicationhost.config.
    < fastCgi >

    < application fullPath \u003d "C: \\ inetpub \\ php \\ php-cgi.exe"

    arguments \u003d "- D My.Website \u003d WordPress"\u003e

    < environmentVariables >

    < environmentVariable name =«PHPRC» value =«C:\inetpub\wordpress» />





    < application fullPath \u003d "C: \\ inetpub \\ php \\ php-cgi.exe"

    arguments \u003d "- D My.Website \u003d phpsite"\u003e

    < environmentVariables >

    < environmentVariable name =«PHPRC» value =«C:\inetpub\phpsite» />






    * This Source Code Was Highlighted With.

    After that, the settings are associated with the corresponding sites in
    Web.config:
    < system.webServer >

    < handlers accessPolicy =«Read, Script» >
    < add name =«PHP» path ="*.php" verb ="*" modules =«FastCgiModule»
    scriptprocessor \u003d "C: \\ inetpub \\ php \\ php-cgi.exe | -d My.Website \u003d WordPress"

    resourceType \u003d "unsypecified" RequireAccess \u003d "Script" /\u003e




    * This Source Code Was Highlighted With.

    In accordance with the configuration given, php.ini
    You need to post in the directory of each site.
    When editing settings, it is worth strictly observe the coincidence of ways to
    the corresponding version of PHP and with
    applicationhost.config and in web.config to
    Avoid unexpected results if the paths are confused.
    At first glance, editing the configuration may seem complex and
    uncomfortable process, but as soon as you get used to configuration in
    XML and distribution of settings by the method
    Ctrl + C, Ctrl + V, you will be surprised at the presence of others
    configuration methods :)

    PHP security settings

    In php.ini Many settings, many of which
    Influence the safety of PHP use. Tune
    Everything is suitable, a decent matter.
    SET ALLOW_URL_FOPEN \u003d OFF
    ; Using the URL for operations with files
    SET ALLOW_URL_INCLUDE \u003d OFF
    REGISTER_GLOBALS \u003d OFF.
    ; Cancellation of global variables
    OPEN_BASEDIR \u003d "C: \\ INETPUB \\";
    Restriction on the directory in which PHP works

    Max_execution_time \u003d 30; limitation
    Script execution time
    Max_input_time \u003d 60.
    Memory_Limit \u003d 16m;
    Restriction on the size of the memory used
    Upload_max_FileSize \u003d 2m.
    post_max_size \u003d 8m
    max_input_nesting_levels \u003d 64.
    display_errors \u003d off.
    ; Disable error messages
    log_errors \u003d ON.
    Error_Log \u003d "C: \\ Error.log"
    Expose_PHP \u003d OFF.
    ; Hide the presence of PHP.

    Conclusion

    PHP on windows is not
    Just wondering and convenient, the main thing is that it works. And the team
    IIS is working on PHP
    worked on windows no worse than on
    UNIX / Linux (of course, try to do better).
    Since this is a new topic for Microsoft, then we can
    make some mistakes, we can not notice something and do not understand, so we
    It is very important to receive comments from you - developers and administrators.
    Write in the comments your wishes and the problems you see now in
    PHP on Windows, and we will
    try to solve problems, and the wishes to implement.

    Tags: Add Tags

    Installing a web server on Linux:

    • If you have Ubuntu, then you will find an article "How to install the Apache web server with PHP 7, MariaDB / MySQL and PHPMYAdmin (LAMP) on Ubuntu 16.10".
    • If you have Arch Linux, then you will find the article "Installing Lamp (Linux, Apache, MySQL / MariaDB, PHP7 and PHPMYAdmin) in Arch Linux / Blackarch".

    Local server is a very useful tool. It is precisely useful to webmasters, programmers on PHP, penetration testers. All programs included in the typical web server installation are free, they have all the source code. The local web server consumes the minimum of resources and, in fact, it is absolutely easy to install and configure.

    This instruction will tell you how to install a local web server without using ready-made assemblies. This method has its advantages. The most important of them are: full control on what you install; Ability to use the latest software versions.

    If you exactly follow the instructions, you will definitely earn everything! In addition to those who have Windows XP - if you have this operating system, then a special instruction is made for you.

    I will show an example of installing on Windows 10, but if you have another version of Windows, then let it confuse you - the procedure is identical everywhere. I will download the latter (the latest) at the time of writing the version of programs. If by the time you read, new versions will come out, then download them.

    Installation steps:

    You can also come in handy:

    1. Preparation (download programs included in the server, creating a server structure)

    We need:

    • Apache. (directly web server)
    • Php. - Wednesday to work PHP programs (required by all websites)
    • Mysql - database management system (required by most websites)
    • phpmyAdmin. - A very convenient tool for managing databases

    Apache developer official website is httpd.apache.org. You can download Apache from this site. But the official version is assembled using the old compiler, for this reason it does not work with new PHP versions. The authors of PHP recommend Apache from ApacheLounge.com/downLoad. Therefore, for this instruction, you download Apache from the site apachelounge.com/download.

    If you have a 64-bit version of Windows, you can choose both a 64-bit and 32-bit version of the components. The main rule - all components must be one of the triumbe. If you have a 32-bit version of Windows, then all components must be 32-bit. This does not apply to phpmyadmin, which is written in PHP. For PHP programs, the concept of biost is not applicable.

    The free version of MySQL is called MySQL Community Server. It can be downloaded on the page. On the same page there is an installer in the form of an executable file, but I recommend downloading a zip archive. On the download page, we are offered to register or log in to the existing account - but it is not necessary to do this. Just click on the link " No Thanks, Just Start My Download" Pay attention to the bitency.

    We also need a C ++ Redistributable Visual Studio 2017 file, i.e. Spreadable component Visual C ++ for Visual Studio 2017 (or any other later), you can download it on the official Microsoft website on the link (direct link to download the 64-bit version; direct link to download 32-bit version). This file is needed for a web server. And for MySQL, you need distributed Visual C ++ packages for Visual Studio 2015. It can be downloaded by software.

    So, I downloaded the following files:

    • httpd-2.4.29-win64-vc15.zip.
    • php-7.2.0-win32-vc15-x64.zip.
    • mysql-8.0.11-winx64.zip.
    • phpmyAdmin-4.7.6-All-Languages.zip.
    • vc_redist.x64.exe.
    • vcredist_x64.exe.

    Set files vc_redist.x64.exe and vcredist_x64.exe..

    2. Creating a web server structure

    Create the structure of the directories of our server. The main idea is to divide the executable files and files of sites with databases. It is convenient for servicing the server, including backup.

    At the root of the disk C: \\ Create a catalog Server. In this directory, create 2 subdirectory: bin. (for executable files) and data..

    Go to the catalog data. and there create subfolders DB (for databases) and htdocs. (for sites).

    Go to the catalog C: \\ Server \\ Data \\ DB \\ and create an empty folder there data..

    3. Installation Apache 2.4

    The contents of the downloaded archive (more precisely speaking, only the catalog Apache24.), unpack in C: \\ Server \\ Bin \\.

    Go to the catalog c: \\ Server \\ Bin \\ Apache24 \\ CONF \\ and open the file. httpd.conf. Any text editor.

    In it, we need to replace a row row.

    Define Srvroot "C: / Apache24"

    Define Srvroot "C: / Server / Bin / Apache24"

    #ServerName www.example.com:80

    ServerName Localhost.

    Documentroot "$ (srvroot) / htdocs"

    Documentroot "C: / Server / Data / Htdocs /"

    DirectoryIndex index.html.

    DirectoryIndex index.php index.html index.htm

    # AllowOverride Controls What Directives May Be Placed in .htaccess Files. # IT CAN BE "ALL", "NONE", OR ANY COMBINATION OF THE KEYWORDS: # ALLOWOINRIDE FILEINFO AUTHCONFIG LIMIT # ALLOWOVERRIDE NONE

    # ALLOWOVERRIDE CONTROLS WHAT DIRECTS MAY BE PLACED IN.HTACCESS FILES. # It can be "all", "none", or any combination of the keywords: # allowOverride FileInfo Authconfig Limit # AllowOverride All

    #LoadModule Rewrite_Module Modules / mod_rewrite.so

    LoadModule Rewrite_Module Modules / mod_rewrite.so

    Save and close the file. Everything, Apache setting completed! Description of each modified directive you will find on this page.

    Open the command line (this can be done by pressing the Win + X key simultaneously). Select Windows PowerShell and Copy there:

    C: \\ Server \\ Bin \\ Apache24 \\ Bin \\ httpd.exe -k Install

    If you receive a request from the firewall to the Apache ratio, then click Allow.

    Now enter into the command line:

    C: \\ Server \\ Bin \\ Apache24 \\ Bin \\ httpd.exe -k start

    And press ENTER.

    As a username, we enter root. Password field leave empty. If everything is done correctly, then everything should look like this:

    7. Using a server and data backup

    In catalog C: \\ Server \\ Data \\ Htdocs \\ Create folders and files, for example:

    c: \\ Server \\ Data \\ Htdocs \\ Test \\ Ajax.php - This file, respectively, will be available at http: //localhost/test/ajax.php, etc.

    To create a full backup of all sites and databases, it is enough to copy the directory C: \\ Server \\ Data \\.

    Before updating modules, make backup folder bin. - In case of problems, it will be possible to easily roll back to the previous versions.

    When re-installing the server or when it is updated, you need to re-configure configuration files. If you have copies of these files, the process can be significantly accelerated. It is advisable to take the following files:

    • c: \\ Server \\ Bin \\ Apache24 \\ CONF \\ httpd.conf
    • c: \\ Server \\ Bin \\ MySQL-8.0 \\ My.ini
    • c: \\ Server \\ Bin \\ PHP \\ php.ini
    • c: \\ Server \\ Data \\ Htdocs \\ phpMyAdmin \\ config.inc.php

    All settings are stored in them.

    8. Additional PHP setup

    PHP is currently very powerful, flexible, convenient tool. On the local computer using it you can solve a variety of tasks, not necessarily related to the generation of Web pages. When solving extraordinary tasks, you can rest in the limit set in the settings. These settings are contained in the php.ini file (C: \\ Server \\ Bin \\ PHP \\ php.ini) Consider some of them:

    Memory_Limit \u003d 128m.

    sets the maximum amount of memory that the script can use

    Post_max_size \u003d 8m

    sets the maximum amount of data that will be accepted when sending by the POST method

    ; Default_charset \u003d "UTF-8"

    sets the encoding (default, the string is commented)

    Upload_max_FileSize \u003d 2m.

    the maximum size of the file being downloaded to the server. Initially, very small size is installed - only two megabytes. For example, when loading a database in PHPMYAdmin, it will not be possible to upload a file more than 2 megabytes until this setting item is changed.

    MAX_FILE_UPLOADS \u003d 20.

    maximum number of files for download at a time

    Max_execution_time \u003d 30.

    maximum execution time of one script

    It is absolutely optional to change these settings, but it is useful to know about them.

    9. Additional PHPMYAdmin Setup

    We have already configured phpmyadmin and most quite enough basic functional. However, on the PHPMYAdmin's start page there is an inscription: "Additional PHPMYAdmin features are not fully configured, some functions have been disabled."

    New features are:

    • showing connections between (related) tables;
    • adding information about tables (starting with version 2.3.0 You can describe in a special table 'table_info' which column will be shown in the pop-up tip when moving the cursor over the connected key);
    • creating a PDF scheme (starting with version 2.3.0 you can create PDF pages, showing links between your tables) in phpMyAdmin;
    • display column comments (starting with version 2.3.0 you can make a comment with a description of each column for each table. And they will be visible in the "preview for printing". Starting from version 2.5.0, comments are used on their own tables and in mode viewing, indicating both pop-ups over columns (properties table) or embedded in a table header in view mode. They can also be shown in the table dump);
    • create bookmarks (starting with version 2.2.0, PHPMYAdmin allows users to bookmarks to requests. It can be useful for frequently used requests);
    • the history of SQL queries (from version 2.5.0 you can save your history of all SQL queries that were made via the phpMyAdmin interface);
    • designer (starting from version 2.10.0, a designer tool is available; it allows you to visually manage the connections between the tables);
    • information about newly used tables;
    • setting up frequently used tables;
    • tracking (starting with version 3.3.x The tracking mechanism is available. It helps you to trace each SQL command that has been performed by phpmyAdmin. Supports recording data and recording commands. After switching on, you can make table versions);
    • custom settings (starting with version 3.4.x, PHPMYAdmin allows users to set most of the settings and save them in the database);
    • customizable menus (starting from version 4.1.0 You can create user groups to which only assigned menu items will be available. The user can be defined in the group and will only see the menu items available for its group);
    • hide / show navigation items (starting from version 4.1.0 you can hide / show items in the navigation tree).
    • other

    Now we will configure these additional opportunities to fully. Follow the http: //localhost/phpmyadmin/chk_rel.php and click "Create a Database". After that, all new features will be activated.

    Several screenshots of new features:

    1) designer

    2) Tracking

    10. Installing the postal stub

    In the C: \\ Server \\ Bin \\ bin directory, create a new directory called Sendmail. Now create a SendMail.php file in this directory with the following contents:

    #! / USR / BIN / ENV PHP

    Open the PHP configuration file, it is placed here. C: \\ Server \\ Bin \\ PHP \\ php.ini. And add one line there:

    Sendmail_path \u003d "C: \\ Server \\ Bin \\ PHP \\ php.exe C: \\ Server \\ Bin \\ Sendmail \\ Sendmail.php --dir C: \\ Server \\ Bin \\ Sendmail \\ Emails"

    Save the file and restart the server. Excellent, now all sent letters will be saved in the catalog C: \\ Server \\ Bin \\ Sendmail \\ Emails \\

    Letters will have expansion .EML and they can be opened, for example, the program Thunderbird.. Or by the usual text editor.

    11. Adding PHP directory in Path on Windows

    If this is not done, there may be problems with some PHP modules, including with php_curl.dll, php_intl.dll, php_ldap.dll, php_pdo_pgsql.dll and php_pgsql.dll. At least, when you start the server, the following appears in the logs.

    PHP Warning: PHP Startup: Unable to Load Dynamic Library "C: \\\\ Server \\\\ Bin \\\\ PHP \\\\ Ext \\\\ php_curl.dll" - \\ xef \\ xbf \\ xbd \\ xef \\ xbf \\ xbd \\ xef \\ xbf \\ xef \\ xbf \\ xbd \\ xef \\ xbf \\ xbd \\ xef \\ xbf \\ xbd \\ xef \\ xbf \\ xbd \\ xef \\ xbf \\ xbd \\ xef \\ xbf \\ xef \\ xbf \\ xef \\ xbf \\ xef \\ xef \\ "- \\ xef \\ xbf \\ xbd \\ xef \\ xbf \\ xbd \\ xef \\ xbf \\ xbd \\ xef \\ xbf \\ xbd \\ xef \\ xbf \\ xbd \\ xef \\ xbf \\ xbd \\ xef \\ xbf \\ xBD \\ xef \\ xbf \\ xbd \\ xef \\ xbf \\ xbd \\ xef \\ xbf \\ xbd \\ xef \\ xbf \\ xbd \\ xef \\ xbf \\ xbd \\ xef \\ xbf \\ xbd \\ xef \\ xbf \\ xbd \\ xef \\ xbf \\ xbd \\ xef \\ xbf \\ xbd \\ xef \\ xbf \\ xbd \\ xef \\ xbf \\ xbd \\ xef \\ xbf \\ xbd. \\ R \\ N in unknown on line 0 PHP Warning: PHP Startup: Unable to Load Dynamic Library " C: \\\\ Server \\\\ Bin \\\\ PHP \\\\ Ext \\\\ PHP_LDAP.DLL "- \\ XeF \\ XBF \\ XBD \\ XeF \\ XBF \\ XBD \\ XeF \\ XBF \\ XBD \\ XeF \\ XBF \\ XBD \\ XeF \\ XBF \\ d \\ xef \\ xbf \\ xbd \\ xef \\ xbf \\ xbd \\ xef \\ xbf \\ xbd \\ xef \\ xbf \\ xbd \\ xef \\ xbf \\ xbd \\ xef \\ xbf \\ xbd \\ xef \\ xbf \\ xbd \\ xef \\ xbf \\ xbd .dll "- \\ xef \\ xbf \\ xbd \\ xef \\ xbf \\ xbd \\ xef \\ xbf \\ xbd \\ xef \\ xbf \\ xbd \\ xef \\ xbf \\ xbd \\ xef \\ xbf \\ xbd \\ xef \\ xbf \\ xbd \\ xef \\ xbf \\ xbd \\ xef \\ xbf \\ xbd \\ xef \\ xbf \\ xbd \\ xef \\ xbf \\ xbd \\ xef \\ xbf \\ xbd \\ xef \\ xbf \\ xbd \\ xef \\ xbf \\ xbd \\ xef \\ xbf \\ xbd \\ xef \\ xbf \\ xbd \\ xef \\ xbf \\ xbd \\ xef \\ xbf \\ xbd \\ xef \\ xbf \\ xbd. \\ R \\ n in unknown on line 0 PHP Warning: PHP Startup: Unable to Load Dynamic Library "C: \\\\ server \\\\ bin \\\\ php \\\\ ext \\\\ php_pgsql.dll" - \\ xef \\ xbf \\ xbd \\ xef \\ xbf \\ xbd \\ xef \\ xbf \\ xef \\ xbf \\ xbd \\ xef \\ xbd \\ xef \\ xbf \\ xbd \\ xef \\ xbf \\ xbd \\ xef \\ xbf \\ xbd \\ xef \\ xbf \\ xbd \\ xef \\ xbf \\ xbd \\ xef \\ xbf \\ xbd \\ xef \\ xbf \\ xbd. \\ R \\ N in Unknown on Line 0

    To avoid these warnings, you need to add the path to PHP to the system variables.

    Click the Start button (or how is it called on windows 10?), Start typing " Change system variables"And open the appropriate settings window.

    There click " Environment Variables»:

    In the window " System variables»Find and click on Path., then click " Change»:

    Raise the entry to the upstairs:

    Close all windows while saving changes made.

    Restart the server.

    12. Hanging, Traffic Slow and / or Error ASYNCHRONOUS ACCEPTEX FAILED

    If your server, even without loading "hangs" - does not show web pages before restarting, and in the ASYNCHRONOUS ACCEPTEX FAILED error logs:

    AH00455: Apache / 2.4.9 (Win64) PHP / 5.5.13 Configured - Resuming Normal Operations AH00456: Apache Lounge VC11 Server Built: Mar 16 2014 12:42:59 AH00094: Command Line: "C: \\\\ Server \\\\ (OS 64) The specified network name is more not available. : AH00341: WINNT_ACCEPT: ASYNCHRONOUS ACCEPTEX FAILED. (OS 64) The specified network name is more not available. : AH00341: WINNT_ACCEPT: ASYNCHRONOUS ACCEPTEX FAILED. (OS 64) The specified network name is more not available. : AH00341: WINNT_ACCEPT: ASYNCHRONOUS ACCEPTEX FAILED. (OS 64) The specified network name is more not available. : AH00341: WINNT_ACCEPT: ASYNCHRONOUS ACCEPTEX FAILED. (OS 64) The specified network name is more not available. : AH00341: WINNT_ACCEPT: ASYNCHRONOUS ACCEPTEX FAILED. (OS 64) The specified network name is more not available. : AH00341: WINNT_ACCEPT: ASYNCHRONOUS ACCEPTEX FAILED.

    Then add an Apache configuration file:

    AcceptFilter HTTP None AcceptFilter HTTPS NONE ENABLESENDFILE OFF ENABLEMMAP OFF

    13. Setting up the CURL in the Apache web server on Windows

    If you do not know what CURL is, then you do not need it. Those. Boldly skip this step.

    cURL is a console utility that allows you to exchange data with remote servers using a very large number of protocols. CURL can use cookies and supports authentication. If a web application requires CURL, this should be indicated in dependencies. For many popular CURL applications, it is not required, for example, for phpmyAdmin and WordPress there is no need to configure CURL.

    If CURL is configured incorrectly, you will receive errors:

    Fatal Error: Call to Undefined Function Curl_multi_init () in ...

    Curl error: SSL CERTIFICATE PROBLEM: Unable to get Local Issuer Certificate

    To CURL worked in Apache on Windows you need:

    1) Be sure to add PHP directory in PATH (System Variables Environment). How to do this is told slightly above:

    2) in the file C: \\ Server \\ Bin \\ PHP \\ php.ini should be unassamed row eXTENSION \u003d CURL

    It is usually not required, but if you wish, you can back up the binary (executable) server files. All these files are in the folder C: \\ Server \\ Bin \\. This is Apache, MySQL and PHP - i.e. Programs that are responsible for the server work, but which we can download from official sites at any time and configure again.

    If you want to make their backup (for example, before updating the server), stop your service:

    C: \\ Server \\ Bin \\ Apache24 \\ Bin \\ httpd.exe -k Stop Net Stop MySQL

    And copy the folder to safe place C: \\ Server \\ Bin \\.

    By the way, you can copy the entire server entirely, i.e. folder C: \\ Server \\ - In this case, simultaneously displays a backup copy and executable files, and data (databases, sites).

    When copying is completed, start the service again:

    C: \\ Server \\ Bin \\ Apache24 \\ Bin \\ httpd.exe -k Start Net Start MySQL

    15. Server Update

    All components that make up a web server are actively developing and regularly published. When you enter the new version, you can update one of some component (for example, PHP), or several minutes.

    17. I do not work

    This instruction is regularly checked and tested with the newest components. Since the instruction is volumetric, then the occurrence of errors may be due to the fact that you missed something or misunderstood. To begin with, try to delete everything and do everything again.

    Over the years of the existence of this instruction, many typical errors arising in a web server were collected, all of them with solving problems are described on a separate page " Errors when setting up and installing Apache, PHP, MYSQL / MariaDB, phpMyAdmin " It also says how to describe your problem correctly, so that you will help you figure it out.

    If something does not work for you, please ask for a question in the comments, search for this error page. To do this, you can use Ctrl + F in your browser and search for a part of the error line.

    It happens a rare error associated with the fact that some other program already listens to the 80th port. To determine whether port 80 is busy do this:

    1) Press the WIN + X key combination

    2) From the opening list, select "Windows PowerShell (Administrator)"

    3) Perform there:

    Cmd for / f "tokens \u003d 1,2,3,4,5 *"% i in ("netstat -aon ^ | findstr": 80 "^ | findstr / i listening") do echo% j% l & @tasklist | Findstr% M.

    If some program is already hanging on the 80m port, then you will see it.

    Removing Server

    If you don't need the server anymoreOr you want to install it again, stop the service and remove them from the autorun sequentially by performing on the command prompt:

    C: \\ Server \\ Bin \\ Apache24 \\ Bin \\ httpd.exe -k Stop C: \\ Server \\ Bin \\ Apache24 \\ Bin \\ httpd.exe -k Uninstall Net Stop MySQL C: \\ Server \\ Bin \\ Mysql-8.0 \\ Bin \\ Remove server files, delete the folder

    Attention, it will delete all databases and your sites. C: \\ Server \\. How to protect the apache web server from hacking in Windows

    With PHP (with version selection), with MySQL and phpMyadmin. This site is posted on it: responsive and qualified technical support, installing WordPress and other web applications in one click,

    The article describes the installation of Apache 2.4 + PHP 5.6 + MySQL 5.6 to the Windows 7/8 / 8.1 / 10 operating system

    Before continuing reading, pay attention to whether you really need to install and configure all this under Windows? Maybe you should pay attention to and not spend your time and nerves on setting up the same directly in Windows? In any case, read the article about. Perhaps she will save you not only time, but also health.

    This instruction will be useful for novice WEB developers who are going to install on their PC with Windows WEB-server Apache with the PHP interpreter of the latest versions. Of course, it is much easier to establish an assembly, like Denwer or resort to the use of installers and not steam about settings. However, every Web developer

    must understand the work process of the Web server, the process of its installation and settings. If you want to install PHP 7, please refer to the article.

    If in the process of assembling the server for this instruction you are faced with problems and still consider yourself a web developer, then it will be the right step to deal with the problems that have arisen, and not write in the comments that the shit instructions. Operating instructions. Checked by time and hundreds of installations. Be careful when performing simple steps. Performing steps manually and analysis of situations, if not earned, add to you Skill as a developer. If you are not a web developer and do not plan to be, then look for an easy way to install on the Internet - this instruction is not for you.

    Note that under Windows XP data version

    VC11 It will be impossible to run (or extremely difficult). Preparatory work

    Make sure you have Windows 7 or newer. If you have Windows XP, this instruction will not help you, since the Apache version described here does not work under Windows XP.

    {!LANG-f74a33ab84b3c383e826200a65345bc6!}

    Delete all Web servers that have been installed before, go to the service and make sure that there is no Apache or IIS. If you have already installed any web server, the second in parallel will most likely not earn at all.

    If you have Skype, be sure to disable the use of 80 port in the settings. Ultimately, you must make sure that no service uses the 80th port.

    To work it is very desirable to have a file manager that allows you to create files with any extensions, or, even better, code editor, like Sublime Text or NotePad ++ or a full-fledged IDE.

    The folder structure may be different, but this instruction is written under a certain structure and, if you follow, everything is guaranteed to work.
    Before you start, create on disk D. folder UsrWith within which you create 5 subfolders: apache., php., tMP., www., log.. Exactly. Without specifying versions.

    In catalog www. Create index files (using a file manager or code editor) that will be needed to verify that everything works:

    • index.html With content: IT WORKS!
    • index.php. With content:

    If the file manager / code code / IDE is not, download the archive with these two files. But if you consider yourself a web developer, you must acquire tools.

    In the PATH system variable, add:

    ; D: \\ usr \\ apache; d: \\ usr \\ apache \\ bin; d: \\ usr \\ php;

    Comments!

    The row numbers given in the examples of configuration files may differ for other versions of Apache and PHP.
    All commands, including editing files, must be carried out on behalf of the administrator.

    Installing Apache 2.4.

    Although for simple development on PHP and there is no need for a separate Web server (in PHP built-in its own web server, which is almost always enough to develop one project), it is still recommended to install and configure the Apache Web server, if only because it would be because The programmer is obliged to know these subtleties. In the end, you will have to work with the Web server and you have to deal with its configuration. So let's proceed.

    1. Download Apache 2.4 BINARIES VC11 Under your system on the link http://www.apachelounge.com/download/vc11/ Most likely you have a 64 discharge OS, so you need a file named, like httpd-2.4. xX-win64-vc11.zip.
    2. If you need any additional modules, you can download them there (for the basic installation there is no need)
    3. Unzatch the contents of the folder Apache24. From the downloaded archive in D: \\ usr \\ apache. Please note that in D: \\ usr \\ apache, you must not put the Apache24 folder from the archive, but its contents. Nothing is required.
    4. In the file change the value Serverroot. on "D: / usr / apache" ( row 37.) and value Documentroot (and Direcroty.) on "D: / usr / www" ( rows 242 and 243). It should also be reduced to the line 218 and change it on: ServerName Localhost: 80
    5. Change the storage settings in the same file (we find the parameters and change): errorlog "d: /usr/log/apache-error.log" customlog "d: /usr/log/apache-access.log" COMMON
    6. Install the APACHE service (on behalf of the administrator). Open the command line on behalf of the administrator and insert the following line: D: \\ usr \\ apache \\ bin \\ httpd.exe -k install
    7. Follow the error messages during the installation of the service. If everything is done correctly, there should be no errors. If after executing the line, the command line did not appear again, then you did something wrong. Just use the features to copy and paste to prevent errors in reprint.
    8. Create a shortcut on the desktop for D: \\ usr \\ apache \\ bin \\ apachemonitor.exe and / or put it in autoload (to open the startup window in Win8 you must press Win + R, then enter shell: startup. and click OK)
    9. Run ApacheMonitor. A shortcut appears in the system tray. Click on it with the left and press, select Apache24 -\u003e Start.
    10. In the browser we go to http: // localhost / - should see IT WORKS!
    11. If you did not see such an inscription, we understand that it went wrong (I read logs, Google, we are trying to deal with the problem independently, since we decided to understand the intricacies of the web server's work)

    Installing PHP 5.6.

    1. Load the latest version VC11 x86.Thread Safe. or VC11 x64.Thread Safe.according to the link http://windows.php.net/download/. Note that you need It will be impossible to run (or extremely difficult). And it is Thread Safe.. The bit must be like Apache. The file you need is likely to be called like: php-5.6.11-win32-vc11-x86.zip or php-5.6.11-win32-vc11-x64.zip
    2. Remove the contents of the archive in D: \\ usr \\ php. As in the case of Apache, nothing is required.
    3. To file. D: \\ usr \\ Apache \\ Conf \\ httpd.conf Add strings: LoadModule php5_Module "D: /usr/php/php5apache2_4.dll" Addhandler Application / X-Httpd-PHP .php # path to php.ini phpinidir "D: / usr / PHP"
    4. And change the value DirectoryIndex on the index.html index.php. (row 276.)
    5. Using ApacheMonitor Restart Apache (Apache24 -\u003e Restart)
    6. We go through the browser http: //localhost/index.php and make sure PHP works.
    7. Making a copy of the file D: \\ usr \\ php \\ php.ini-development With name D: \\ usr \\ php \\ php.ini
    8. Using the search we find, well and change the parameters: extension_dir \u003d "d: / usr / php / ext" sys_temp_dir \u003d "d: / usr / tmp" extension \u003d php_mysql.dll extension \u003d php_mysqli.dll extension \u003d php_opensl.dll date.timezone \u003d Europe / Zaporozhye.
    9. Perform a command line php -m. To view a list of connected modules.
    10. Restart Apache Using ApacheMonitor

    Virtual Hosts in Apache

    1. If multiple projects are debugged on the computer, you may need virtual hosts (sites). On the example, we will consider two virtual hosts: s1.Localhost. and s2.Localhost.. For convenience, we will create folders with the same names that is not necessarily in the real system.
    2. It should be noted that when using virtual hosts, the parameter Documentroot Apache configuration file no longer makes sense. The main host of the server (which will be available at http: // LocalHost /) is now first Virtual Host In the configuration file of virtual hosts!
    3. First you need to add to the C: \\ Windows \\ System32 \\ Drivers \\ ETC \\ Hosts file: 127.0.0.1 S1.Localhost 127.0.0.1 S2.Localhost

      You need to do this on behalf of the administrator. It is advisable to reboot after that, but in practice it was not required. If you cannot change the file (access rights), you can copy it to your desktop, change, and then copy back.

    4. Create folders for virtual hosts D: \\ usr \\ www \\ s1.localhost and D: \\ usr \\ www \\ s2.localhostwhere files will be located. In each of the folders create a file index.html with content S1. and S2. Accordingly (to control the fact that everything works as needed)
    5. Then create folders for logs: D: \\ usr \\ log \\ s1.localhost and D: \\ usr \\ log \\ s2.localhost - Here the logs of each site will be stored. In fact, the logs can be stored in one folder, but I used to do so - I am so comfortable.
    6. Next, you need to enable virtual host support. In file D: \\ usr \\ Apache \\ Conf \\ httpd.conf Rassate the string Include conf / extra / httpd-vhosts.conf
    7. Next edit the file d: \\ usr \\ Apache \\ CONF \\ EXTRA \\ httpd-vhosts.conf - It should look like this (each virtual host is its block VirtualHost): Serveradmin. [Email Protected] Documentroot "d: /usr/www/s1.localhost" servername s1.localhost serverias www.s1.localhost errorlog "d: /usr/log/s1.localhost/error.log" CustomLog "D: / USR / LOG / S1 .localhost / access.log "COMMON Serveradmin. [Email Protected] Documentroot "D: /USR/www/s2.localhost" ServerName S2.Localhost Serverias www.s2.localhost errorlog "d: /usr/log/s2.localhost/error.log" CustomLog "D: / USR / LOG / S2 .localhost / access.log "COMMON
    8. First Virtual Host s1.Localhost. Now it will be the main host of the system, because Its block follows the first in the configuration file, i.e. will be available at the entrance to