Enable IIS to support PHP using isapi (applicable to 4.x. X)

Source: Internet
Author: User
Tags apache php download zend php mysql small web server

1. First, extract the php compressed package (PHP4.3.2 is used as an example here) to the C: php Directory, and find a file named php. ini-recommended file, renamed as php. ini.

2. open the file and find extension_dir = ". /", change it to extension_dir =" C: phpextensions "; then find the session. save_path =/tmp and change it to session. save_path = C: phpsessions. (Note: In this case, you need to create the sessions folder in the C: php Directory to store sessions)

3. Copy the modified php. ini file to the C: winnt directory, and copy the php4ts. dll file under C: php to the C: winntsystem32 directory.

4. Open "Internet Service Manager", select a site that supports PHP, open the properties page, click the "ISAPI filter" tab, and click "add ", in the pop-up "Filter Properties" window, fill in "php" in "Filter Name", and fill in "C: phpsapiphp4isapi" in "Executable File. dll, and click OK.

5. Click the "main directory" tab, select the "configuration" button in "application settings", and click "add" in the "Application configuration" window that appears, in the displayed "Add/edit application extension ing" window, enter "C: phpsapiphp4isapi" in the "Executable File. dll, and fill in "php" for "extension"

OK. Restart IIS and write a phpinfo file under your page file directory to test whether the PHP file can be correctly parsed. If a 500 error occurs, make sure you have not forgotten step 3.

_________________________________________________________________

Configure the iis/apache php mysql environment in Windows

I have not written many tutorials, and most of them are from others' tutorials. However, what I have introduced here is a summary of my experience. -- Introduction

The execution efficiency of PHP is obvious to all, which is one of the reasons I like it. To integrate it with Mysql and Apache, which is called a wonderful partner, we can't help but wonder at its efficiency. PHP is also updated very quickly. The latest version PHP4.3.2RC4 is listed here (there are almost no bugs, and it is estimated that the official version will be available soon after the writing), and the installation process of the latest version Mysql4.0.13.

PHP installation files can be directly to the http://www.php.net/download, get for win32.zip package (5.8 M)
Mysql installation files can be downloaded directly to the http://www.mysql.com, get for win32.zip package
In addition, if you want to experience the combination of Apache and PHP and want to give up IIS, please download the latest for win31. MSI installation package in http://www.apache.org, the latest version is 2.0.45.
In addition, you can download Zend Optimizer to accelerate PHP. Specific access to http://www.zend.com

<1> install and configure PHP
1. decompress the PHP compressed package to C: PHP (this path can be used at will, but please modify the path as follows ).
2. Copy all the php4ts. dll and C: PHPdlls files under the C: PHP Directory to the windows system folder, which varies depending on the Windows version.
C: windowssystem for Windows 9x/ME
C: winntsystem32 for Windows NT/2000
C: windowssystem32 for Windows XP/server2003
C: The system disk of your current operating system. If your current operating system is not installed in C: windows, modify the disk accordingly.
Copy php. ini-dist to C: windows (XP/2003/9 x/Me) or C: Winnt (2000/nt) and rename it php. ini. Open it in notepad and modify the following information:
Search the extension_dir =./line and point its path to the extensions directory under your PHP Directory, for example:
Extension_dir = C: PHPextensions
If you want to support more modules, follow these steps. If you don't want to, simply save the php. ini file.
PHP supports many modules, but some dll files are not free of charge, so they are not released along with the PHP compressed package. However, there are many modules in the dlls folder, we copied them to the system32 folder just now. Now we can test how many modules it supports. The following are my test results for your reference only. If the xxx. dll module is not supported in the pop-up after installation, you can simply add the semicolon (;) and search:
Windows Extensions
; Note that MySQL and ODBC support is now built in, so no dll is needed for it.
;
The following sections describe the supported extension modules with semicolons. If you want PHP to support a certain module, remove the previous ";". The following is the result of my test, it is normal to remove the comment as follows:
Extension = php_bz2.dll
Extension = php_c2.16.dll
Extension = php_crack.dll
Extension = php_curl.dll
Extension = php_db.dll
Extension = php_dba.dll
Extension = php_dbase.dll
Extension = php_dbx.dll
Extension = php_domxml.dll
Extension = php_exif.dll
Extension = php_fdf.dll
Extension = php_filepro.dll
Extension = php_gd2.dll
Extension = php_gettext.dll
Extension = php_hyperwave.dll
Extension = php_iconv.dll
; Extension = php_ifx.dll
; Extension = php_iisfunc.dll
Extension = php_imap.dll
Extension = php_interbase.dll
Extension = php_java.dll
Extension = php_ldap.dll
Extension = php_mbstring.dll
; Extension = php_mcrypt.dll
Extension = php_mhash.dll
Extension = php_mime_magic.dll
Extension = php_ming.dll
Extension = php_mssql.dll
Extension = php_msql.dll
; Extension = php_oci8.dll
Extension = php_openssl.dll
; Extension = php_oracle.dll
Extension = php_cmd.dll
Extension = php_pgsql.dll
; Extension = php_printer.dll
Extension = php_shmop.dll
Extension = php_snmp.dll
Extension = php_sockets.dll
; Extension = php_sybase_ct.dll
Extension = php_w32api.dll
Extension = php_xmlrpc.dll
Extension = php_cmdt.dll
Extension = php_yaz.dll
Extension = php_zip.dll
After the modification, save php. ini and install and configure PHP.

<2> install Mysql
Mysql is relatively independent. This database is very small and cannot be operated directly. It is not as intuitive as access or SQL2000. However, there are already a lot of software that can perform well on it, for example, phpMyAdmin and mysqlcc. These software can be downloaded from the http://www.mysql.com, which is not detailed here.
After downloading and obtaining the Mysql for win32installation package, open it with winzipand run setup.exe directly. Note that you should select an installation path. Of course, the installation path can be any, but I suggest installing it with PHP and selecting the C: MySQL directory. After the installation is complete, MySQL is complete. For setting users and passwords, you can use the two software mentioned above for management. The description is not continued here. The default username is root and the password is blank.
Usually after the installation of MySQL will automatically start the service, if not started, please run C: MySQLinmysqld-nt.exe

The next installation depends on what you choose as your Web server. I suggest using Apache. If you think it is in conflict with your IIS, use IIS directly.

<3> IIS configuration:
Open IIS, right-click on "Default Web site" to open properties, and perform the settings shown in the following figure in the main directory. Note the steps:

After that, the IIS + PHP + MySQL environment is set up.

<4> if you do not have IIS, install Apache, a small Web Server:
We downloaded an Msi Installation File for win32. After you double-click it, Apache installation is automatically executed. Follow the prompts to install it, the content to be written is filled in according to your preferences, which has no effect. Of course, the directory I suggest you And the PHP Directory should be selected C: directory. After installation, You Can See C: apache2. After installation, the apache icon is displayed in the system tray in the lower right corner of the desktop. You can double-click the Apache Control Panel to stop or restart the server.
Here we need to modify the C: Apache2confhttpd. conf file and open it in Notepad:
Find:
# NameVirtualHost *
To:
NameVirtualHost 127.0.0.1
Find:

Modify the following lines:
ServerAdmin (the Administrator mailbox you entered during installation)
DocumentRoot c: Apache2htdocs
ServerName Apache2
ErrorLog c: Apache2logserror_log
CustomLog c: Apache2logsaccess_log common

Find:
AddType application/x-tar. tgz
Add the following two lines below:
AddType application/x-httpd-php. php
AddType image/x-icon. ico
Find:
# LoadModule ssl_module modules/mod_ssl.so
Add a row below:
LoadModule php4_module C: phpsapiphp4apache2. dll
Add default files:
Find the DirectoryIndex * line. You can add the default file name as follows:
DirectoryIndex index. php default. php index.htm index.html default.htm default.html
Save the file and restart the apache server.

The PHP environment has been fully established.

<5> Zend Optimizer installation (optional)
After the download is A. EXE file, you can install it directly. You must select the PHP version during the installation process. Here, I select php 4.3.x to check whether to back up php before installing. ini. Click OK and the installation will end.
Open php. ini and modify the following content:
Find:
[Zend]
You can see below:
Zend_optimizer.optimization_level = *
This line,
Change the value after = to 1023, that is, change this line
Zend_optimizer.optimization_level = 1023
After saving, it will be OK. Restart Apache/IIS and the installation is complete. I am also tired.

<6> test:
Use NotePad to create a new file, write down the following lines, and save them to the C: Apache2htdocs Directory, which is your site and directory named phpinfo. php. enter http: // localhost/phpinfo in the browser. php will be able to see as much information as possible about PHP.
CODE


Phpinfo ();

?>

Note that when you save the file, the file suffix should be. php. (Notepad will automatically add the. txt suffix after the file name, unless you

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.