Modify the php. ini location in Windows

Source: Internet
Author: User

If you and I work like ASP and PHP at the same time, then IIS should be used as Web server. However, if IIS is used, you must put PHP. ini under the Windows System (C:/Windows or C:/WINNT ).

But what should I do if I really don't want to put PHP. ini in C:/Windows (or C:/WINNT?

 

The following content is saved as an inifilepath. Reg:

Windows Registry Editor Version 5.00
 
[HKEY_LOCAL_MACHINE/SOFTWARE/PHP]
"IniFilePath"="D://Appserv//php//"

"D: // appserv // PHP //" is where the new PHP. INI is located.

Next, right click inifilepath. Reg into double click, and then move PHP. ini from C:/Windows (or C:/WINNT) to the new location.

Make sure to perform the migration. Otherwise, PHP will still retrieve PHP. ini under C:/Windows (or C:/WINNT.

Finally, restart IIS and use the phpinfo () function to see If php. INI is running to a new location.

In addition, if you use php.exe to compile a PHP program in the Command column mode, PHP. ini in the new location will also be used.

 

 

There are two methods: 1 is to set the system environment variable; 2 is to set the php. ini location in Apache HTTP. conf. Details:

Method 1, reference: http://www.cnblogs.com/leilei/archive/2008/06/12/1218613.html

① Add the PHP Directory to the Windows Path

In Windows NT, 2000, XP, and 2003:

  • Go to the control panel and open the "System" icon (Start> Settings> Control Panel> system, in Windows XP/2003, Start> Control Panel> L System)
  • Select "advanced" tab
  • Click "environment variable ".
  • In the system variables Column
  • Locate path (you may need to scroll down to find it)
  • Double-click the path item.
  • Add your PHP Directory at the end, including the Semicolon ";" (for example:; C:/PHP, my path is; E:/usr/PHP)
  • Click "OK" and restart the computer.

② Make the php. ini file used by PHP in Windows

(This step is very important. I have tested it. Without this step, PHP will not be able to find PHP. ini)

In Windows NT, 2000, XP, and 2003:

  • Go to the control panel and open the "System" icon (Start> Settings> Control Panel> system, in Windows XP/2003, Start> Control Panel> L System)
  • Select "advanced" tab
  • Click "environment variable ".
  • In the system variables Column
  • Click "new" and enter "phprc" in "variable name". In "variable value", enter the directory of the php. ini file (for example, C:/PHP)
  • Click "OK" and restart the computer.

Method 2, reference: http://topic.csdn.net/u/20081216/16/2C9D3EA2-567E-4031-9F8D-193F493B343A.html

Add the following to HTTP. conf:
Phpinidir "E:/httpd/PHP"
LoadFile "E:/httpd/PHP/libmysql. dll"
LoadFile "E:/httpd/PHP/libmcrypt. dll"

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.