---
title: "PHPIniDir使用"
author: "javaeyeren"
date: "2009-02-02T01:35:00Z"
tags: []
slug: "phpinidir"
draft: false
lastmod: "2009-02-02T01:35:00Z"
id: 601358
url: "https://javaeyeren.iteye.com/blog/601358"
---

\# configure the path to php.ini  
PHPIniDir "C:/php"

PHPIniDir是PHP的初始化文件php.ini的路径。许多朋友将php.ini放入windows目录下，但是这不是一种好的方式，因为系统搜寻php.ini的顺序是：

(1) PHPIniDir；

(2) 注册表键值：HKEY\_LOCAL\_MACHINE-&gt;SOFTWARE-&gt;PHP-&gt;IniFilePath；

(3) 环境变量%PHPRC%；

(4) PHP5的根目录（For CLI），或者WWW的根目录（For SAPI moudles）；

(5) Windows目录（C：\\windows）；

很明显，在hpptd.conf中设置PHPIniDir是最好的办法。（PHPIniDir的设置跟PHP的版本有关系