PHP server configuration (using Apache and IIS two ways) _php tips

Source: Internet
Author: User
Tags php server win32
First, use Apache

Installation of ≡php 5.2.5
1, to its official site download Php-5.2.5-win32.zip and decompression (said: Do not download and use its installer, this way although very automated, very intelligent, but there are many aspects of the restrictions, because it is not recommended. To a directory "D:\PHP\PHP".
Copy the php.ini-recommended from the PHP directory (D:\PHP\PHP) to the directory of Windows (Winnt directory) and rename it to PHP.ini, and find Extension_dir to modify it to extension _dir= "D:\PHP\PHP\ext". The same effect can be achieved with php.ini-dist, but it is recommended that you use php.ini-recommended, because this file performs performance and security optimizations on the default settings.
PHP.ini section explains:
Default_charset= "gb2312", modify the default character set, here, if preceded by a semicolon ";", remove this semicolon;
Register_globals=off is changed to Register_globals=on, which makes it effective to pass global variables;
Extension=php_dba.dll if preceded by a semicolon, remove the semicolon to the same below;
Extension=php_dbase.dll
Extension=php_gd2.dll GD Library to do drawings, generally used for graphics verification code;
Extension=php_mysql.dll is used to connect MySQL database;
Short_open_tag=on support <?php ...? > and <?...? >,off to support only <?php ...? >

Copy the Php5ts.dll and Libmysql.dll (used to support MySQL) files in the D:\PHP\PHP directory to the Windows system folder, namely: C:\windows\system32.

Installation of ≡apache 2.2.8
1, to its official site download Apache_2.2.8-win32-x86-no_ssl.msi and implementation.
Press the Next button 3 times, the installer requires you to enter your network domain (network domain name), server domain (server domains) and webmaster e-mail, and some words to fill in truthfully, this note is about the local self-built test environment, so casually, the first two fill localhost, the Mail can write their own.
When you enter next, the default installation path is "C:\Program files\apache Software foundation\apache2.2\", modify the path, and change to the "D:\PHP\Apache2.2" you want.
Then all the way down until the installation is over; At this point, open the PHP folder under D disk, you can see a folder named Apache2.2.

2, open IE, and then enter in the Address bar: "http://localhost" or "http://127.0.0.1" can see the success of the Apache installation completed page;

3, the conf/httpd.conf file configuration
1 Find "DocumentRoot", here is the directory where the specified home page is placed. The default is: "D:\PHP\Apache2.2\htdocs", you can use the default directory, you can also define one, such as: "d:/php." Note: Do not add "/" at the end of the table.
2 Find "DirectoryIndex", here is the default first page file name, you can add index.php in the back of the index.html. Multiple file names are separated by spaces.
3) Find
<directory/>
Options FollowSymLinks
AllowOverride None
Order Deny,allow
Deny from all
</Directory>
Modified to:
<directory/>
Options FollowSymLinks
AllowOverride None
Order Deny,allow
Allow from all
</Directory>
If you do not change here, you may be able to appear in the Don t have permission to access/on this server. Such error prompts, especially after changing the path of the default home page.

4) Establish virtual directory
Find <ifmodule alias_module> ... </IfModule>
Add Alias/webpath "D:\PHP\Apache2.2\phptxt"
<directory "D:\PHP\Apache2.2\phptxt" >
Options MultiViews
AllowOverride None
Order Allow,deny
Allow from all
</Directory>
Where/webpath is the virtual directory name, and "D:\PHP\Apache2.2\phptxt" is the location where the file is stored.
The address of the visit is: http://localhost/webpath/

5 to enable the server to support PHP, in the appropriate place to add the following two sentence code
LoadModule php5_module "D:\PHP\PHP\php5apache2_2.dll"

AddType application/x-httpd-php. php. PhP3. Inc.

Note: Modifying the httpd.conf file requires a reboot of the Apache2.2 before it takes effect.

Ii. using IIS to parse PHP files
1, ditto, the first installation of PHP 5.2.5.
2, open IIS Manager, select the "Default Web Site"-> "Properties", Pop-up dialog box select "Home directory" first card, execute permissions to "script and executable file", click "Configuration", add application extension mapping, executable file Selection "D:\PHP\PHP\ Php5isapi.dll, extension. php, and select all actions, script engines, and confirm that the file exists.
For the Win2003 system, you also need to add a Web service extension, the required file is "D:\PHP\PHP\php5isapi.dll", the extension is "PHP", the condition is changed to allow.

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.