WIN2003 the environment variable cannot be read after IIS consolidates PHP

Source: Internet
Author: User
Tags iis ini mysql mysql client variables php server phpinfo client

In general, you can implement a page that displays Phpinfo (). Start with the problem that appears after you can display the page.

Problems with PHP will be displayed on the Phpinfo () page.

First, see if the path to your own php.ini is correct.

Q: I have configured the php.ini file, but why is there no effect after restarting the server?

A: There are several main problems with this problem.

The first reason is that the php.ini file read by the system is inconsistent with the php.ini file you modified at that time.

1, you can use the Phpinfo () configuration File (php.ini) path option to see what the current PHP server read php.ini

2, if you want to change the php.ini file access location, you can refer to the php.ini search order, as follows:

A the location specified by the SAPI module (phpinidir directive in Apache 2, the-C command-line option in CGI and CLI, Php_ini parameter in NSAPI, THTTPD environment variable in php_ini_path)

b) Hkey_local_machine\software\php\inifilepath (Windows registry location)

c) PHPRC Environment variables

d) Current working directory (for CLI)

e Web server directory (for SAPI modules) or PHP directory (other cases under Windows)

f) The Windows directory (C:\windows or C:\winnt), or the location specified by the--with-config-file-path compile-time option

3. General Practice: By setting PHPRC environment variables,

A) Action: Right-click My Computer-> Properties-> Advanced-> Environment variables

b Create an environment variable under the system variable named PHPRC, and the variable value is the file path of your php.ini file

The second reason is: PHP did not find the appropriate extension library

1, view the extension of PHP found in the location: Phpinfo () Extension_dir options can be seen

2. Change Extension_dir file in php.ini

Third reason: IIS is not fully restarted

1. Modifications to the php.ini must be completely restarted for IIS to work, not just for the current site to restart.

2, enter cmd, stop server: net stop iisadmin; Start server: net start w3svc

Q: How does my php have no way to activate the MySQL extension library

A: In PHP5.0 above, MySQL is not enabled by default, so we need to activate it manually.

1, in PHP run MySQL, must be activated in the php.ini php_mysql.dll Dynamic Connection Library, in addition to access to the MySQL Client connection library that Libmysql.dll file

2. The Php_mysql.dll Dynamic Connection Library can be activated via extension in php.ini, and Libmysql.dll file must be placed in the Windows system path to access. You can also add a path to the PATH environment variable by copying the Libmysql.dll to the System32 directory.

3, Recommended Practice: By setting path to facilitate future PHP upgrades, in the system environment variables in the path after adding "Libmysql.dll" folder can be. Remember to separate by ";"

4, [case] Recently, the server is always unable to find the MySQL extension library, resulting in the program can not run. Therefore, after removing all files, reconfigure the PHP server. But at the end of the day when MySQL was installed, the MySQL extension library was never activated.

The information found in Phpinfo () is as follows:

path:c:\php

phprc:c:\php

Extension_dir:c:\php\ext\

In addition, I tested the activation of other libraries, such as mSQL, GD2, XML, in Phpinfo () to be displayed correctly

The proof that PHP can find Php_mysql.dll dynamic Connection library, and MySQL running another condition is able to interrogate MySQL Client connection library that is Libmysql.dll file, it seems that the problem is here.

I to C disk search Libmysql.dll file, found in the System32 and PHP folder has a file, do a backup, I tried to delete system32 Libmysql.dll file, found to be locked, unable to delete, but can rename, I casually modified the name, and then restart IIS, server Run normally.

Add: If Configuration File (php.ini) Path is displayed as C:\Windows

Indicates that the php.ini file was not read.

In addition, I found that there are two ways to integrate PHP with IIS: ISAPI and CGI mode

Both of these ways, we can see the Phpinfo page

However, the environment variable cannot be read using ISAPI mode, so the php.ini path set by the environment variable PHPRC cannot be found.

Use CGI so that you don't have to copy a lot of files to the system file.



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.