Let Apache 2 prepare for PHP
From now on, you need to install more in manual way, you can't simply click and choose a few options. I am used to it as soon as possible, this is the way Apache. You need to edit files to set different configuration options; if you don't operate, what you do will hinder the correct loading of Apache. If you set an error, then the error may be recorded in the Apache 2 error log (default is C: /installDir/apache2/logs/error.log). But after all, it is a small number, most errors will only be logged into the Windows event log (Start | Settings | Control Panel | Administrative Tools | Event Viewer).
Unfortunately, the Windows event log is not a convenient tool when you debug the installation settings. Better approach is to test the loading of the Apache server in the command line window, so you can see the error report immediately. So, after completing the configuration modification I will discuss, open a command line window to switch to the binary directory of Apache (C: / InstallDir / Apache2 / bin), where to start Apache.
The Apache profile is c: /apache/apache2/conf/httpd.conf, you can use any text editor to edit. Find DirectoryIndex, locate this line: DirectoryIndex index.html index.html.var # index.php In order to allow apache to process PHP pages, you want to delete a comment character (#), becomes: DirectoryIndex index.html index.html.var Index .php
Also allow you to use the .htaccess file in any directory, so find the Allowoverride in the configuration file, change this setting from NONE to all. After saving the changes, you can continue to open the file in the text editor, because when you install PHP, you must edit this file again.
Install PHP
Although the source code of PHP can be downloaded, it is best to use a binary issue package directly with Apache 2. Apache 2 can take two ways to run the PHP program: run through a CGI interface (external call php.exe), or use the PHP's DLL file to run in the Apache. The latter way is faster. Therefore, 2 Windows binary issuings are available for each version of PHP. Smaller is the .msi package, which will install the CGI executable program php.exe, but take off the modules required to run the PHP script through the Apache DLL. A larger .zip package includes all these things, you can download them from the Win32 area of the snaps.php.net website. After the file is downloaded, extract it to the C: / PHP (Reserved Folder Name). Unless you have an absolute grasp, please download the PHP manual at the same time, it has multiple languages to choose from.
Configure Apache 2 to run PHP4
Now come to the most interesting part: the Apache and PHP are perfectly matched. First, copy all the DLL files in the C: / PHP / DLLS directory to the system directory (% windir% / system) of Windows. Next, lookups in the Apache's configuration file (httpd.conf) contains that section containing a large number of addtype commands, adds the following line: addtype application / x-httpd-php .php C: / php/php.ini-recommended copy Go to the Windows Directory (% windir%), rename it as php.ini, and open it with a text editor. Edit the 3 lines set for doc_root, extension_dir and session.save_path, making it the same as the following, pay attention to replace installdir to replace the name of your Apache 2 installation directory. Doc_root = c: / apache / apache2 / htdocsextension_dir = c: /php/extensionsSession.Save_path = C: / Temp is allowed to use the forward slash and backslash in session.save_path. The PHP manual claiming that these path parameters need to add a backslash at the end, but this statement is incorrect. Don't do this in PHP 4.3. Also, if C: / Temp does not exist, create it yourself. The next step is to allow Apache to run a PHP program as a module, which requires you to take 2 steps. First, copy C: /PHP/PHP4TS.DLL to Windows system folder (% windir% / system). Find the LoadModule section in httpd.conf, add this line below: loadModule PHP4_Module "C: /php/php4apache2.dll" If you need to run the PHP program in the CGI mode for some reason, use php.exe), Please turn the above line into a comment, and add the following lines in httpd.conf: scriptalias / php / "c: / php /" action application / x-httpd-php "/ php/php.exe" everything Yet?