这个PHP指令(include_path)在哪里设置?

时间:2022-09-30 22:52:34

From phpinfo() I can see the include_path directive is set to this:

从phpinfo()我可以看到include_path指令设置为:

include_path

.:/usr/lib/php:/usr/local/lib/php:/home/username/php
.:/usr/lib/php:/usr/local/lib/php

I cannot figure out where this is being set. It is not in the usual places: php.ini or an .htaccess file.

我无法弄清楚这是在哪里设置的。它不在通常的地方:php.ini或.htaccess文件。

If it helps, the server is using cPanel, so it might have been set there, but I cannot find the setting there either.

如果它有帮助,服务器正在使用cPanel,所以它可能已在那里设置,但我也找不到那里的设置。

This is something I set up, maybe two years ago, and for the life of me i can't remember what I did, so any insight would be appreciated.

这是我设置的,也许是两年前,对于我的生活,我不记得我做了什么,所以任何见解都会受到赞赏。

Thanks.

谢谢。

3 个解决方案

#1


1  

To troubleshoot, If you have shell access, and you're using Apache, try

要进行故障排除,如果您有shell访问权限,并且您正在使用Apache,请尝试

<Directory />
AllowOverride None
</Directory> 

In httpd.conf. Make sure to restart apache. Then see if the path changes. This will disable .htaccess overrides. I know you're saying it's not .htaccess, but it's worth a try to prove that it's not in an override.

在httpd.conf中。确保重启apache。然后查看路径是否发生变化。这将禁用.htaccess覆盖。我知道你说它不是.htaccess,但值得一试,以证明它不是一个覆盖。

Important: You should only do this if it's a development server or a live server that isn't relying on these features.

重要提示:只有在开发服务器或不依赖这些功能的实时服务器时才应执行此操作。

#2


1  

Anywhere you want it to be!

你想要的任何地方!

It's a config option that can be set at in point in PHP's initialization or execution.

它是一个配置选项,可以在PHP的初始化或执行中进行设置。

  1. It's default value is in the system php.ini (installed in different places depending on the OS, poke around in /etc in *nix systems and C:\WINDOWS\system32 in... you guessed it... windows systems).
  2. 它的默认值是在系统php.ini中(根据操作系统安装在不同的地方,在* nix系统中的/ etc和C:\ WINDOWS \ system32中... ...你猜对了... windows系统)。
  3. If you're running mod_php under apache, you can set it per directory in .htaccess
  4. 如果您在apache下运行mod_php,则可以在.htaccess中为每个目录设置它
  5. You can always change it runtime (in your php scripts) via ini_set('include_path', $somepath) or set_include_path($somepath) (keep in mind that this replaces the previous value)
  6. 您可以随时通过ini_set('include_path',$ somepath)或set_include_path($ somepath)更改运行时(在您的php脚本中)(请记住,这将取代之前的值)
  7. If you're running a console script, you can change it via php -d include_path=[WHATEVER PATH]
  8. 如果您正在运行控制台脚本,可以通过php -d include_path = [WHATEVER PATH]进行更改

Sorry if this doesn't help you narrow the problem down, but maybe it'll jar your memory a bit about what you actually did?

对不起,如果这不能帮助你缩小问题范围,但也许它会让你的记忆有点关于你实际做了什么?

#3


0  

You can override the php include path from an .htaccess file: http://cpanelhostingstuff.com/how-do-i-set-php-include_path/

您可以从.htaccess文件覆盖php include路径:http://cpanelhostingstuff.com/how-do-i-set-php-include_path/

You can also have php.ini files in subdirectories that take precedence over the global one: http://www.geeksengine.com/article/php-include-path.html

您还可以在子目录中拥有优先于全局文件的php.ini文件:http://www.geeksengine.com/article/php-include-path.html

#1


1  

To troubleshoot, If you have shell access, and you're using Apache, try

要进行故障排除,如果您有shell访问权限,并且您正在使用Apache,请尝试

<Directory />
AllowOverride None
</Directory> 

In httpd.conf. Make sure to restart apache. Then see if the path changes. This will disable .htaccess overrides. I know you're saying it's not .htaccess, but it's worth a try to prove that it's not in an override.

在httpd.conf中。确保重启apache。然后查看路径是否发生变化。这将禁用.htaccess覆盖。我知道你说它不是.htaccess,但值得一试,以证明它不是一个覆盖。

Important: You should only do this if it's a development server or a live server that isn't relying on these features.

重要提示:只有在开发服务器或不依赖这些功能的实时服务器时才应执行此操作。

#2


1  

Anywhere you want it to be!

你想要的任何地方!

It's a config option that can be set at in point in PHP's initialization or execution.

它是一个配置选项,可以在PHP的初始化或执行中进行设置。

  1. It's default value is in the system php.ini (installed in different places depending on the OS, poke around in /etc in *nix systems and C:\WINDOWS\system32 in... you guessed it... windows systems).
  2. 它的默认值是在系统php.ini中(根据操作系统安装在不同的地方,在* nix系统中的/ etc和C:\ WINDOWS \ system32中... ...你猜对了... windows系统)。
  3. If you're running mod_php under apache, you can set it per directory in .htaccess
  4. 如果您在apache下运行mod_php,则可以在.htaccess中为每个目录设置它
  5. You can always change it runtime (in your php scripts) via ini_set('include_path', $somepath) or set_include_path($somepath) (keep in mind that this replaces the previous value)
  6. 您可以随时通过ini_set('include_path',$ somepath)或set_include_path($ somepath)更改运行时(在您的php脚本中)(请记住,这将取代之前的值)
  7. If you're running a console script, you can change it via php -d include_path=[WHATEVER PATH]
  8. 如果您正在运行控制台脚本,可以通过php -d include_path = [WHATEVER PATH]进行更改

Sorry if this doesn't help you narrow the problem down, but maybe it'll jar your memory a bit about what you actually did?

对不起,如果这不能帮助你缩小问题范围,但也许它会让你的记忆有点关于你实际做了什么?

#3


0  

You can override the php include path from an .htaccess file: http://cpanelhostingstuff.com/how-do-i-set-php-include_path/

您可以从.htaccess文件覆盖php include路径:http://cpanelhostingstuff.com/how-do-i-set-php-include_path/

You can also have php.ini files in subdirectories that take precedence over the global one: http://www.geeksengine.com/article/php-include-path.html

您还可以在子目录中拥有优先于全局文件的php.ini文件:http://www.geeksengine.com/article/php-include-path.html