Under normal circumstances, the page of phpinfo() can be displayed. Let’s start with the problems that arise after being able to display this page.
PHP problems will be displayed on the phpinfo() page.
First, check whether the path of your php.ini is correct.
Q: I have configured the php.ini file, but after restarting the server Why doesn't anything work?
A: This problem mainly involves the following situations.
The first reason is that the php.ini file read by the system is inconsistent with the php.ini file you modified at the time. 1. You can check the current PHP server reading through the Configuration File (php.ini) Path option of phpinfo() Which php.ini is
2. If you want to change the file access location of php.ini, you can refer to the search order of php.ini, as shown below:
a) The location specified by the SAPI module (PHPIniDir directive in Apache 2, -c command line option in CGI and CLI, php_ini parameter in NSAPI, PHP_INI_PATH environment variable in THTTPD)
b) HKEY_LOCAL_MACHINESOFTWAREPHPIniFilePath (Windows registry location)
c) PHPRC environment variable d) Current working directory (for CLI)
e) The web server directory (for SAPI module) or the directory where PHP is located (other cases under Windows)
f) Windows directory (C:windows or C:winnt), or the location specified by the --with-config-file-path compile-time option 3. General approach: By setting the PHPRC environment variable,
a) Operation: Right-click My Computer->Properties->Advanced->Environment Variables b) Create a new environment variable under system variables with "the variable name is PHPRC and the variable value is the file path of your php.ini file"
The second reason is: PHP did not find the corresponding extension library 1. Check the location of the extension library found by PHP: You can see it in the extension_dir option of phpinfo() 2. Change the extension_dir file in php.ini
The third reason: There is no complete restart IIS
1. Modifications to php.ini must be completely restarted to take effect, not just the current site.
2. Enter cmd, stop the server: net stop iisadmin; start the server: net start w3svc
Q: Why can’t I activate the MySql extension library in my PHP?
A: In PHP5.0 and above, MySQL is not enabled by default, so we need to activate it manually.
1. To run MySql in PHP, you must activate the php_mysql.dll dynamic link library in php.ini. In addition, you need to access the MySQL client link library, that is, the libmysql.dll file. 2. You can activate the php_mysql.dll dynamic link library through the extension in php.ini. Connection library; and the libmysql.dll file must be placed in the Windows system path PATH to access it. You can copy libmysql.dll to the system32 directory, or add a new path to the PATH environment variable.
3. Recommended approach: Set PATH to facilitate future PHP upgrades. Just add the folder where "libmysql.dll" is located after PATH in the system environment variable. Remember to separate them with ";" 4. [Case] Recently, the server cannot find the MySql extension library, causing the program to fail to run. Therefore, delete all files and reconfigure the PHP server. But in the end, when I installed MySql, I could not activate the MySql extension library.
The information found in phpinfo() is as follows:
PATH:c:php
PHPRC:C:php
extension_dir:c:phpext
In addition, I tested activating other libraries, such as msql, gd2, xml, and they can be displayed normally in phpinfo(), proving that PHP can find the php_mysql.dll dynamic link library, and another condition for the operation of MySql is to be able to query the MySQL client. The terminal connection library is the libmysql.dll file. It seems that the problem lies here.
I searched for the libmysql.dll file on the C drive and found that there was a file in the system32 and php folders. After making a backup, I tried to delete the libmysql.dll file in system32 and found that it was locked and could not be deleted, but it could be renamed. I changed the name casually and restarted IIS, and the server ran normally.
One additional point: If the Configuration File (php.ini) Path is displayed as C:Windows
, it means that the php.ini file has not been read.
In addition, I found that when using IIS to integrate php, there are two ways: ISAPI and CGI mode.
In both ways, we can see the phpinfo page
but using ISAPI mode, the environment variables cannot be read, so the environment variable PHPRC is set. The php.ini path cannot be found.
Just use CGI, so you don't have to copy many files to the system file.