php.ini include_path

一曲冷凌霜 提交于 2019-11-30 09:17:05

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');

-- Edit --

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.

The php.ini file will have include_path already in it, but commented out, that is where you should put it, by uncommenting it. It also has examples for windows. It will look like this, just remove the semicolon preceding "include_path"

; Windows: "\path1;\path2"
;include_path = ".;c:\php\includes"

Hit this link when I was trying to debug why the include_path in my php.ini file was not taking effect. I am talking about my ubuntu setup with a bitnami api. The solution was to restart the php-fpm using ./ctlscript properly. Was restarting only apache but had to restart php-fpm as well.

Hopefully helps somebody trying it in ubuntu with a bitnami lampstack.

If you discover this thread and you're using a current version of WAMPServer you might run into the issue I had where you edit the php.ini referenced in the phpinfo() report, but it doesn't change the includes path. Doing a search of the WAMP directory showed 2 DLL's (both named php5ts.dll in the php and apache dirs) where the include path is specified. Use the Bitnami WAMP environment instead (https://bitnami.com/stack/wamp/installer). GO PATS!

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!