Apache + php installation and configuration in windows, apachephp

Source: Internet
Author: User
Tags vc9

Apache + php installation and configuration in windows, apachephp
Download and configure phpDownload php: http://windows.php.net/download/ php-5.4.16-Win32-VC9-x86.zip download apache: http://httpd.apache.org/download.cgi#apache22

1. First, copy all dll files in php5 (including dll files in the ext folder) to the system32 folder in Windows, such as C: WINDOWS \ system32. This step is to allow the windows system to obtain the dll file run by PHP. The significance is the same as that of specifying the system environment variable, but to make it simple, copy the dll file directly to the windows System directory.

2. Change "php. ini-development" to "php. ini ". Php. ini is a file that records PHP configuration information. Open php. ini in the editor and configure the following format:

;extension=php_bz2.dll

";" Indicates that the configuration is invalid. Therefore, we need to remove the ";" sign before the configuration item we need:

extension=php_curl.dllextension=php_gd2.dllextension=php_mysql.dllextension=php_pdo.dllextension=php_pdo_mysql.dllextension=php_pdo_sqlite.dll

For example, extension = php_gd2.dll indicates that PHP is enabled to support the GD2 Image Library. These are commonly used configurations, which are also supported by most host vendors.

 

3. Set the extended support directory

If you follow the preceding settings, the system still prompts that the extension module is not supported. If mysql is not supported, You can manually set the extension directory in the php. ini file:

extension_dir = "E:/php/ext"

 

1. Support for PHP parsing:

Modify httpd. conf In the conf directory of apache installation. In the LoadModule, append (or change to) the following Configuration:

LoadModule php5_module "D:/Program Files/php-5.4.8-Win32-VC9-x86/php5apache2_2.dll"PHPIniDir "D:/Program Files/php-5.4.8-Win32-VC9-x86"AddType application/x-httpd-php .php

 

 

Ii. Change the default resolution directory:

Search for the keyword "# DocumentRoot" and add (or change to) the following Configuration:

DocumentRoot "E:/html"

Not far from the following, there is such a line: # This shoshould be changed to whatever you set DocumentRoot

Change <Directory "C:/***"> to the corresponding Directory Configuration:

<Directory "E:/html">

Note: You can change the Apache resolution path to your actual resolution path based on your actual situation.

After completing the preceding two configuration items, click Start> program> Apache HTTP Server 2.2.22 to start the Apache Web service or restart the Apache Web Service for the configuration to take effect.

Test PHP support

Open the editor, create a PHP file, and type the following code:

<?php  phpinfo();?>

Save the file to the E:/html folder and name it phpinfo. php. Enter http: // 127.0.0.1/phpinfo. php in the address bar of the browser to access the file. The PHP system information is displayed on the browser page.

 

Virtual Host

Modify C: \ Windows \ System32 \ drivers \ etc \ hosts to add 127.0.0.1 test.local.com

Modify httpd. conf In the conf directory of apache installation, search for "# Virtual hosts", and add (or change to) the following Configuration:

<Directory />    Options FollowSymLinks    AllowOverride None    Order allow,deny    Allow from all</Directory>

 

Include conf/extra/httpd-vhosts.conf

Modify httpd-vhosts.conf, add

<VirtualHost *:80>  DocumentRoot C:/dev/svn/phpinfo  ServerName test.local.com</VirtualHost>

Enter http://test.local.com/phpinfo.php in the address bar of the browser. The browser page should contain the PHP system information.

 

Source http://www.cnblogs.com/ggjucheng/p/3348536.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.