在 Windows 7 和 Apache 2.2.15 上运行的 PHP5.3.5 会忽略 PHP.ini 设置
我使用 MSI 安装程序下载在 Windows 7 Home Premium 上安装了 PHP5.3.5。我用它覆盖了 C:\php5\ 中的 PHP5 的早期版本。
第一次测试时,服务器无法启动。我通过在 Apache2.2 httpd 文件中添加 PHP 的路径来修复此问题,其中安装程序插入了 2 行代码,指向 ini 文件目录和 PHP DLL,但省略了目录路径。完成此操作后,服务器启动正常,我可以运行 phpinfo 在本地主机上的 Web 浏览器中查看 PHP 设置。
在 phpinfo 中,它指出加载的配置文件如预期的那样为 C:\php5\php.ini。但是,如果我对设置进行任何更改并重新启动服务器,则任何更改都不会反映在 phpinfo 中。是的,我确实刷新了浏览器窗口。
如果我将 php.ini 重命名为其他名称以使其不可见 phpinfo,则可以正确识别没有加载 php.ini 文件。
因此 php.ini 中的设置被忽略,并使用一些默认设置(但我不知道这些设置是从哪里派生的)。据我所知,我的计算机上没有其他 php.ini 文件。
在 phpinfo 中,它指出配置文件 (php.ini) 路径是 C:\Windows,但这与我使用的 Windows XP 计算机上的相同。在 windows 文件夹中我没有看到任何 php.ini 文件。
在windows注册表中,没有提及PHP5,PATH环境变量以C:\php5\开头;
所以希望有人可以建议我如何让 PHP5 注意到 C:\php5\php.ini 设置。 :)
I did an install of PHP5.3.5 on Windows 7 Home Premium using the MSI installer download. I got it to overwrite a previous version of PHP5 in C:\php5\
When first testing it, the server failed to start. I fixed this by adding the path to PHP in the Apache2.2 httpd file where the installer had inserted 2 lines of coded pointing to the ini file directory and the PHP DLL but had left out the directory path. After doing this, the server starts ok and I can run phpinfo to view the PHP settings in my web browser on local host.
In the phpinfo it states that the loaded configuration file is C:\php5\php.ini as expected. But if I make any changes to the settings, and reboot the server, none of the changes are reflected in phpinfo. Yes, I do refresh the browser window.
If I rename the php.ini to something else to make it invisible phpinfo then correctly identifies that there is no php.ini file loaded.
So the settings in php.ini are being ignored and some default settings are being used (but I have no idea where these are derived from). As far as I can tell, there are no other php.ini files on my computer.
In phpinfo it states that the Configuration File (php.ini) Path is C:\Windows but this is the same as on a Windows XP computer that I work on. And in the windows folder I don't see any php.ini file.
In the windows registry, there is no mention of PHP5, and the PATH environment variable starts with C:\php5\;
So hopefully someone can suggest how I can get PHP5 to take notice of the C:\php5\php.ini settings. :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可能有多个 php.ini 文件。如果你这样做了,而你没有意识到你这样做了,你会慢慢地发疯[我是根据经验说的]。
那么,您是否已从以前版本的 php 升级到当前版本?如果是这样,请删除所有以前版本的 php.ini 文件。检查您的环境和系统变量路径。消除对以前版本的任何引用。
你说你正在运行 Apache,但 MSII 也在运行,还是你把它关闭了?
您可能必须进入注册表(我不再使用 MS 操作系统,所以我不知道 VISTA 或 Sys7 实现注册表的内容或方式。遇到此问题时我使用 XP,并且必须手动删除以前版本的 PHP 的注册表项 !
运气真好
You may have more than one php.ini file. If you do, and you don't realize that you do, you will be slowly driven insane [I speak from experience].
So, have you upgraded from a previous version of php to your current version? If so, delete all previous version php.ini files. Check your environment and system variable paths. Eliminate any references to previous versions.
You say youp're running Apache, but is MSII also running, or did you turn it off?
You may have to go into registry ( I no longer use MS OS so I don't know what or how VISTA or Sys7 implement Registry. I used XP when I had this problem and I had to manually eliminate Registry entries for previous versions of PHP.
Lots a luck!