Enable IIS to support PHP,ISAPI or cgi,fastcgi full configuration tutorial (latest php5.2.13 configuration method) _win server

Source: Internet
Author: User
Tags anonymous dbase ldap parent directory phpinfo file permissions phpmyadmin zend

Configure the ISAPI mode of PHP under Windows Server 2003 IIS6 by adding a new Web service extension in IIS's Web service extensions, with the program suffix PHP,ISAPI program as Php5isapi.dll. And then my Computer.-> Properties-> Advanced-> "Environment variables"-"System variables" Add the variable name PHPRC, the value is php.ini path , in Internet Information Services Manager, select the Web site or application root directory, open the Directory property page ( Right-select Properties), and then select Home directory. Click the "Configure" button and select "Map" tab. Click "Add ..." in "Executable" set to: C:\php\php5isapi.dll, with the extension set to. php, select "Confirm File exists" and "OK" to save the settings. Restart the server to complete the configuration of PHP.

The red part of the above do not do, because with the ISAPI with PHP, do not read the system variables (CGI method to read), the relevant permissions are set as follows:
< the folder where the Web page is configured "iusr_***" Read permission, if you want to write to modify the permissions
The folder where the PHP file resides is configured with Read permissions for the network SERVICE and iusr_***.
php.ini file to "network SERVICE" Read permissions
Test the SYSTEM32 directory DLL file to give "iusr_**" read and Run permissions

Unzip the PHP binary compression package to the D:\php directory
Then open "My Computer"-> "->" "Advanced"-> "Environment variable"-> "System variable"-> "path", edit its value, add the following path to the front
;D: \php;d:\php\ext (note the semicolon before)

in IIS consolidated php , there are two ways: ISAPI and CGI mode, both of which we can see phpinfo page, but use ISAPI mode, cannot read environment variable, so through environment variable PHPRC set php.ini path cannot be found. You can use CGI so that you don't have to copy a lot of files to the system file.

configuration file ( PHP 3 in is Php3.ini , since PHP 4 from the php.ini ) in the PHP is read at startup. For the server module version of PHP, only the
The Web Server reads once when it starts. For both CGI and CLI versions, each invocation is read.
php.ini search paths are as follows ( in order ):
* SAPI the location specified by the module ( Apache2 in the Phpinidir directives , CGI and CLI in the - C command-line Options , NSAPI
the php_ini parameter in the thttpd ,the Php_ini in the _path environment variable )
*hkey_local_machine\software\php\inifilepath(Windows Registry Location )
*PHPRC environment Variables
* Current working directory ( for CLI)
*web Server directory ( for SAPI modules ) or PHP directory ( Other cases under Windows )
*windows directory (C:\windows or C:\winnt), or The location specified by the--with-config-file-path compile-time option

I'm inSERVER2003+PHP4environment to meet this problem, the solution is to write in frontPATHenvironment variable, you add aPHPRC, point toX:\php4\php.ini, restart can be, if it is not, finally there is a trick isinstallationZend,PHPAccelerator because the installationZend, you will specifyphp.inipath, you will also specify that the server you are using isIISor isApache, the essence is to modify the registry, but I do not know where to modify the location, so I am in the above operation or invalid case, the last installationZend, and finally succeeded in solving the problem.

Copy php.ini-dist or php.ini-recommended to the C:\Windows directory and rename to PHP.ini
The server of General official release website uses php.ini-recommended security is high
And as a debugging server with Php.ini-dist better
Of course, under normal circumstances, this php.ini still need to be modified according to the actual situation.
Here are some of the necessary modification options:
Copy Libmysql.dll to System32 directory
Extension_dir = "D:\php\ext"
This is the directory where the PHP extensions are placed, make sure you are the same as the directory you are actually installing.
Set the correct time zone:
Find "Date.timezone" set to: Date.timezone = PRC
The following actions selectively turn the PHP extension on or off
The above, with no semicolon at the beginning, is an open extension, and a semicolon is an extension that is not open.
Session.save_path = C:\sessions
This is the default save directory for the session file, which must be a directory that exists, or the default sessions function will not work. I'm setting up a directory on a RAMDisk. Setting the Session.save_path on RAMDisk can speed up session processing. If you do not have RAMDisk installed, you can assign it to any of the other disks, such as C:\sessions directory, C:\Windows\Temp directory, and so on.
OK, the basic work is done and now it's time to configure IIS.
Open Internet Information Services (IIS) Manager, and in Web service extensions, select Add a new Web service extension, and the extension can be filled in
PHP ISAPI extension, required file selection: D:\php\php5isapi.dll (if PHP4 is installed, this is C:\php\sapi\php4isapi.dll
, the same below), and set the extension status to allow.
Open the Web site-> Properties-> ISAPI Filter-> Add, the filter name can be filled in "PHP", and the executable file is still selected
Open the Web site-> Properties-> The home directory-> application settings-> configuration-> Application Extensions-> Add, or select the executable file
--> You can add index.php as the default content document by opening the Web site-> Properties-> document-> enable default content document-> Add.
Then select the server machine name-> "All Tasks"-> "Restart IIS" to restart IIS.
In the default Web site publishing directory, create a test page:
Download: phptest.php
Phpinfo ();
If you open this page to see the PHP installation configuration information, even if the installation is successful.
If you want to optimize the execution of PHP program, you can install Zendoptimizer-2.6.0-windows-i386.exe, this thing installation is very simple, here is not
Now the upgrade is very simple. Just download the new version of the PHP binary compression pack, remove the original D:\php directory, and unzip the new version to

IIS PHP filter Php5isapi.dll failed to load

Reason: The server made security settings, the d:\php Everyone permissions removed, IIS naturally unable to load Php5isapi.dll.
Workaround: d:\php directory plus everyone user set permissions are: Read only.

The two hardest places I've encountered are: Php5isapi.dll not loaded and unable to start MySQL properly, now share my solution.

"Php5isapi.dll not Loaded":
After setting up on IIS, "All unknown ISAPI extensions" and "Active Server Pages" in the Web service extensions are also turned on, but the Php5isapi.dll written to the ISAPI filter is either "State: Unknown" (no icon), or " Status: Not started (red down arrow icon).
1. First of all, the limitation of permissions is caused by two parts: System file permissions and server extended permissions, first to the location of the ISAPI link library file, and then to the full control of everyone in the file (you can also choose to read + Write + Execute combination of permissions).
2. Address Server extended permissions: to the IIS6.0 "Server Extensions" Settings page, if you want to save trouble, you can directly click the "Allow all unknown ISAPI" button, but I do not recommend this, so it is not safe! We should add a new server extension here, the extension you can fill in, the file is selected to the ISAPI link library file, and then check the "Set status to allow" after the save.
3. In order for the settings to take effect, please reboot the system, restart your ISAPI extension will be normal loading!

"Unable to start MySQL properly"
The general reason is that it was previously installed, and is now upgraded or reinstalled after being uninstalled in the control Panel. Upgrade the words do not mention, generally are my.ini caused. The most troublesome for the new person originally did not uninstall clean, now reload MySQL caused in Windows services can not start the project normally, error tip: 1067.
There are five steps to completely erase MySQL: (My system is 2003 server, please note!) )
1. Do not rush to the control Panel to uninstall. CMD into the bin directory under MySQL, execute mysqld-nt-remove, prompted to close the window after completion.
2. Control Panel Uninstall.
3. My operating system is 2003 server, so there is no My.ini file in the Windows directory, do not need manual removal, only to the original installed path folder deleted, remember is completely deleted, not moved into the Recycle Bin.
4. CMD executes regedit, enters the registry, looks for the keyword MySQL, the system disk record part all deletes, certainly may have one or two is not the system disk writes the project, does not matter. Press the F3 key to find the next until all the lookups are complete. (New people remember to back up the registration form first!) )
5. Reboot.
Basically, the above five steps are completely cleared, and after the reinstallation is complete, the service can be started and the security settings will be saved in the basic MySQL Server Instance Config Wizard settings.
This is the 5-point operation that I've summed up after a new 1067 error, which may seem simple, but may be helpful to some friends who are also new. Welcome veteran advice.

in 2003 of the system configuration, some permissions are not set up in place will toss for a long time, here to share some experience, convenient for everyone to consult at the same time for their own inspection.
1, check the directory of php.ini file permissions, and give everyone Read permission;
2, check the directory PHP5ISAPI.DLL file permissions, and give everyone Read permission;
3, if the above two steps do not solve the problem, in the Add removal program in the system component configuration to cancel the installation of IIS, and reinstall the IIS, and then the PHP ISAPI module settings.

One. Run the phpMyAdmin program prompt "Unable to load MySQL extensions, check the PHP configuration" for the following workaround:
MySQL database is not installed properly, MySQL-related services are not started in System services (please read the tutorial on installing MySQL and PHP carefully)

Two. Install the discuz! forum prompt "does not support MySQL database, unable to install forum" solution is as follows:
1, the Libmysql.dll file is missing in the System32 (C:\windows\system32) directory of the system, the solution is to find the Libmysql.dll in the PHP directory and copy Libmysql.dll to C:\windows\ In the System32 directory
2, in the php.ini file in the C:\windows directory, there is no "; Extension=php_mysql.dll" in the preceding one ";" Remove, so can not use the corresponding function, the solution is to open the php.ini file to find
; Extension=php_mysql.dll
Change into
Extension=php_mysql.dll//Remove the front; make it effective
3,mysql the correct permissions for the installation directory are as follows:
System Full Control
MySQL installation directory only need the above two permissions on it, the other user rights are deleted

Important, but also check the permissions of the php.ini file, check the copy to system32 inside the php file permissions, check the PHP installation directory folder permissions, at least the users default permissions;

The Temp folder for the C disk Windows directory should have at least the Users group modify level permissions.

Strongly recommended in the new version of the Standard 2003 system configuration! First configure the Environment installation program, the installation program to do after the system security settings, etc.

(Be sure to reboot the server at last)

If none of the above are valid, then: http://www.jb51.net/softs/26224.html
Outside the PHP5.2.11 automatic installation package (non-star system can also be installed), relatively fast, for IIS have not configured the environment of the friend to use, this version is installed in the C disk, in fact, the installation is also good, generally installed in D-disk and other non-system installation disk. The latest Win2003 support is better php5.2.12 version, although not the latest is also good.
phpMyAdmin Error:
Fatal Error:session_start () [<a href= ' Function.session-start ' >function.session-start</a>]: Failed to Initialize storage module:files (path:) in D:\f4jgwy\jgwynet\web\pmbba\libraries\session.inc.php on line 75
There are two ways to fix this:
1. In the error file the session start (), before adding the following code: Ini_set (' Session.save_handler ', ' files ');. This method is suitable for use by users of leased space.
2. In the php.ini file, explicitly specify the session's Save_path (such as c:/tmp) and then restart the Web service. If the server's administrative permissions belong to you, it is more convenient to change this way.
to cancel; Session.save_path = "/tmp" comment
Cause Analysis: PHP5 A security-mode bug, the default session Save_path is the system's temporary directory, which will verify permissions.

You cannot create a session when an error occurs, check the PHP or Web server logs, and configure the PHP installation correctly.
1, try to restart the MySQL service can be resolved,--invalid
2, find Php5.ini documents, found
Session.save_path = "D:\xampp\tmp"
Know the Save directory for the session, and then go to the D:\xampp\tmp directory and empty all the files,
Again into the phpmyadmin, all normal. ----invalid
3, open My Computer-system installation disk (usually a good word is C disk)--Open the Windows folder--Find the TEMP directory;
Right-click to open Properties, point to security options, if not you can open the tool on the top of the window--Folder Options--View--Remove the tick before "Use single file Sharing (recommended)"---invalid
4, use the Phpinfo function to see your PHP installation, and check the loaded Configuration the correct configuration, if the item is displayed as None,

after restarting the server or restarting IIS, all sites are stopped and cannot be started automatically, requiring manual startup.
Solution One:
My Computer--right----management--services and applications--services. Found it:
IIS Admin Service
World Wide Web Publishing Service
Modified to Automatic.
Solution Two:
The server is the operating system of WIN 2003, IIS restart or server restart after the Web site services inside IIS all stopped, let a person depressed for a while, the site manually started, hard to think of reasons, is not the serv-u with the relationship?
If the serv-u7.1.0.2 because of the reason, how to let the Web site after restarting the machine automatically run it? After the inquiry, serv-u7.1.0.2 occupies 80 ports, into the serv-u7.1.0.2 settings, turn off the automatic operation can be!
In addition, when you are debugging a Web site in local IIS, you often encounter a situation where the default Web site stops after restarting IIS, and you can use the command netstat-anb to see if the 80 port is occupied, find the process that occupies 80 ports, and turn it off to start the default Web site. Thunder is the default occupancy of 80 ports.
Php5isapi.dll failed to load. The data is wrong. 64-bit windows2003 is incompatible with PHP5?
Start support for 32-bit IIS in 64-bit Windows IIS:
Finally, 1 indicates that support for 32-bit is enabled, and 0 disables support for 32-bit, which, of course, should be started at this time, with 1 selected.
Then restart IIS
net start IISAdmin
net start w3svc
Mysql_connect () not supported please check that the MySQL module is loading correctly
See/usr/lib/php/modules/There's no mysql.so in there.
Locate the Redhat installation disk and locate the server directory
Upload, install:
RPM-IVH php-pdo-5.1.6-20.el5.i386.rpm
RPM-IVH php-mysql-5.1.6-20.el5.i386.rpm
View the so file again: ls/usr/lib/php/modules/
dbase.so ldap.so mysqli.so mysql.so pdo_mysql.so pdo.so pdo_sqlite.so phpcups.so
1, check the apache,mysql,php and its components are installed correctly, the service has been started.
2. View/usr/lib/php/modules/under dbase.so ldap.so mysqli.so mysql.so pdo_mysql.so
pdo.so pdo_sqlite.so phpcups.so mysql.so exists.
If it does not exist: Locate the Redhat installation disk and find the server directory
3. Add in/etc/php.ini
4, restart httpd and mysqld
phpMyAdmin warning:require_once (./libraries/common.inc.php) Error resolution after installation
After installing the phpMyAdmin, the following error will appear in IE access:

Fatal error:require_once () [function.require]: Failed opening required './libraries/common.lib.php ' (include_path= '.; C:\php5\pear ') in D:\php\phpMyAdmin\index.php on line 36

After a burst of debugging finally found the solution:
The original phpMyAdmin installation directory of the superior directory permissions, then to the parent directory plus IIS anonymous user "read and run" permissions, and then open the phpMyAdmin page, success!
1, do not put phpMyAdmin decompression installed in the root directory, because so that anonymous users will have the root directory permissions.
Related Article

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.