Recently, the company used PHP to do the development of customers. Learn how to install apache+php under XP SP3. This is recorded so that information can be found later.
First, apache+php configuration
1. Download Apache server, for compatibility consideration, use earlier version apache2.2, download is MSI file, directly double-click Install can. (If it is Win7 system, the security of the Win7 system than XP to high, I have to help colleagues installed, found that the installation of apache2.2, but Windows services inside the Apache service can not install, checked the page, the original is the issue of permissions, installation system services require administrator rights. There are related solutions: under C:/windows/system32 find Cmd.exe, right key-> operation mode, as the system administrator status, after, in the CMD into the Apache installation directory, execute command httpd-k install can. )
Then find apache2.2 in the service, start up, and start Apache Monitor from the menu,
If you enter http://localhost:8080/in the browser and return to the It Works page, prove that Apache can work. 8080 is the port specified for Apache at installation time.
2. Download the PHP package. It is recommended that you download the ZIP package and configure it slightly. I use the php5.2.12 VC6 TS version (TS is to indicate thread safe,nts is not thread safe, threads are secure, and if you focus on stability, it's best to use TS, especially if you need access to public resources such as external files. VC6 and VC9 refer to compiled dependency packs, VC6 instructions are compiled in the context of the visual Studio 6 compiler, VC9 compiled in Microsoft 2008 C + + runtime environment, and you need to ensure that the system has Microsoft 2008 C + + Runtime Library. The general old version of XP recommends selecting VC6. The following is the original php.net:
If you are are using PHP with Apache 1 or Apache2 from apache.org your need to use the VC6 versions of PHP
If you are are using PHP with IIS your should use the VC9 versions of PHP
VC6 versions are compiled with the legacy Visual Studio 6 Compiler
VC9 versions are compiled with the Visual Studio 2008 compiler and have in improvements and performance. The VC9 versions require to have the Microsoft 2008 C + + Runtime (x86) or the Microsoft 2008 C + + Runtime (x64) Installe D
)
3. After downloading PHP, extract to d:/php, the path is best not to include spaces and Chinese. Open php.ini-recommended, Extension_dir = "./" in the sentence of the./Modify to D:/php/ext (corresponding to your PHP in the Ext folder path), and then open some basic library: will; extension=php_ Mb_string.dll, extension=php_pdo.dll the semicolon removed before the line. (If you need to use a database, you need to open the corresponding extension based on the corresponding database type)
Save the modified file as PHP.ini (this is to keep the original file, if the configuration error, you can copy a reconfiguration directly from the php.ini-recommended)
4. Open the httpd.conf configuration file in the Conf folder under the Apache installation directory (this is Apache's core configuration file).
Find positioning to
#LoadModule Vhost_alias_module modules/mod_vhost_alias.so
This line, (i.e. at the end of a large loadmodule statement)
Add the following configuration:
Phpinidir "d:/php"
LoadModule Php5_module D:/studio/php/php5apache2_2.dll
AddType application/x-httpd-php. php
The above path needs to correspond to the actual installation path.
Then find DirectoryIndex to add a index.php (you can guarantee access when no filename is specified, skip to index.php, that is, the default home page. )
DirectoryIndex index.html index.php
5. Open the PHP installation directory and copy the Php5ts.dll files to the c:/windows/system32.
6. Restart Apache in the service.
7. Edit a test.php in the Htdocs under the Apache installation directory, input <?php echo phpinfo (); >
After saving, enter http://localhost:8080/test.php in IE if output a PHP version Information page is a success.
Two. Configuring PHP in IIS (under XP SP3)
1. Install IIS.
2 Install PHP (recommended to choose IIS-specific, that is, VC6 or VC9), here or VC6.
The steps are the same as above, unpack, configure Extension_dir, and turn on the basic extensions
3. Copy the modified php.ini to the c:/windows.
4. Open IIS, right-click the [Default Web site], select Properties, in the newly opened Default Web Site Properties dialog box, click the ISAPI Filter tab, click the Add button to the right of the filter, and add a name called PHP, Filter pointing to Php5isapi.dll files in the PHP directory
Switch to the Home Directory tab, in the Application Configuration column, click the Configure button, add an application mapping, extension. PHP, point to Php5isapi.dll in the PHP directory, and then save and restart IIS.
5. Copy Php5ts.dll to C:/windows/system32
6. Add a test.php as described above under the Inetpub of IIS, and access via IE, as normal.
Third, IIS usually have script file permissions settings, if the PHP contains read and write files in the code fopen,fwrite, it is likely to error, reported permission Denied. So if you have the ability to read and write files, you need to modify some configurations.
1. First open the iis[Default Web site]== [Properties]==] tab, click the [Edit] button to view the corresponding IIS script username, remember this user name
2. In the root directory of the PHP Web site project, right key = "Sharing and security]=" switch to the Web Sharing tab, select [Shared Folders], and set up to have read and write permissions to save
3. In any folder, open the "Tools]=" [Folder Options]= [view] tab, and cancel the check on the "Enable Simple File sharing" column. Then in the PHP site project's root directory, right key = "Sharing and security]=>[Security" tab, select the corresponding user (that is, the user name seen in 1), set it with file read and write permissions.
Tested under XP SP3. apache2.2, php5.2.12