PHP's include_path - set it to an empty string doesn't work
I have Apache HTTP开发者_开发问答 Server v2.2 with PHP in FastCGI communication.
I tried to edit the include_path
variable in php.ini
to an empty string but it didn't work,
the path remains: .:/usr/local/lib/php
(as seen by phpinfo()).
:
), then the include path finally changes.
How can I set it to an empty string?
Thank you.
The value has to be something besides an empty string. If you don't want PHP to include anything from anywhere, you can set it to some nonexistent path (and let it fail to find the path when it tries to include stuff). It's not an ideal solution, but it'll work.
I have a feeling you're going about this wrong, though. include_path
is extremely useful, unless you intend to hard-code your app's path everywhere (which is a bad idea in itself, IMO). If you set it to just .
, that should be enough to get rid of paths that shouldn't be in there, while keeping it practical to include
stuff.
Now that there is more context behind the question. This is more of a sysadmin question, but here's the response:
Per virtual host you can configure specific php.ini settings:
For apache: https://serverfault.com/questions/34078/how-do-i-set-up-per-site-php-ini-files-on-a-lamp-server-using-namevirtualhosts
http://php.net/manual/en/configuration.changes.php
Now, if you aren't applying this to virtual hosts, and it's per user, I'm more then certain this is possible under the user public_html configurations.
精彩评论