php.ini include_path [英] php.ini include_path

查看:82
本文介绍了php.ini include_path的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我到处搜索,似乎找不到答案.我正在尝试在本地wamp服务器的php.ini文件中设置包含路径.我目前不了解两件事之一:

I've searched all over the place and can't seem to find an answer for this. I'm trying to set an include path in the php.ini file of my local wamp server. I currently don't understand one of two things:

  1. 在包含路径设置本身的引号中要加上的内容.
    例如,如果我想添加C:\wamp\www作为包含路径,会是
    include_path = ".;C:\wamp\www\"吗?
  2. 在何处放置包含路径行.我可以把它放在任何地方,还是必须把它放在特定的地方?
  1. What to put in the quotes of the include path setting itself.
    For example, if I wanted to add C:\wamp\www as an include path, would it be
    include_path = ".;C:\wamp\www\"?
  2. Where to put the include path line. Can I put it anywhere, or do I have to put it in a specific place?

我已经检查过的研究中发现的一些常见错误.

Some common errors I've read about in my research that I've checked.

  • 我正在编辑位于C:\wamp\bin\php\php5.3.8
  • 的php.ini文件
  • 进行更改并使用phpinfo()函数检查服务器是否已更新之后,我已重新启动服务器.
  • I'm editing the php.ini file located at C:\wamp\bin\php\php5.3.8
  • I've restarted the server after I've made my changes and have checked if it had updated using the phpinfo() function.

更新
这是我目前拥有的,但仍然无法使用.

UPDATE
This is currently what I have, but it still doesn't work.

; Windows: "\path1;\path2"
include_path = ".;C:\php\pear;C:\wamp\www"

推荐答案

这一切都取决于您要完成的工作.就个人而言,我不会直接编辑php.ini文件来设置include_paths,而是在代码中使用以下结构:

This all depends on what you are trying to accomplish. Personally, I don't edit the php.ini file directly for setting include_paths, rather I use the following construct, in code:

// This will append whichever path you would like to the current include path
// And I believe that PHP is smart enough to convert / with \ if on a windoze box
// If not you can replace / with DIRECTORY_SEPARATOR
set_include_path(get_include_path() . PATH_SEPARATOR . 'my/custom/path');

-编辑-

可能您的系统上可能有多个php.ini副本,并且您没有编辑PHP正在使用的副本.

Chances are there may be multiple copies of php.ini on your system, and that you are not editing the one that is being used by PHP.

这篇关于php.ini include_path的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆