2

I need help in understanding include_path and where it is set. When I echo include path this is what I see:

.:/Applications/XAMPP/xamppfiles/lib/php

From what I understand there are two paths currently in the include_path separated by colon. First one is the

'.' which indicates the current directory
and the second one is the path
'/Applications/XAMPP/xamppfiles/lib/php'

So my questions are:

1) Is the above understanding correct?
2) Where is the include_path set because I looked at my php.ini file  in /Applications/XAMPP/xamppfiles/etc but I couldn't find this being mentioned in the file

This is what my php.ini had and the same seems to be commented:

; UNIX: "/path1:/path2"
;include_path = ".:/php/includes"

Also including my phpinfo output

Configuration File (php.ini) Path   /Applications/XAMPP/xamppfiles/etc
Loaded Configuration File   /Applications/XAMPP/xamppfiles/etc/php.ini
Scan this dir for additional .ini files     (none)
Additional .ini files parsed    (none) 
FBP
  • 345
  • 3
  • 15
  • http://php.net/manual/en/ini.core.php#ini.include-path . the default is `.;/path/to/php/pear` this can be changed from all places including code. so you may need to check the XAMPP's php configuration, any htaccess file etc.... – bansi Dec 31 '15 at 10:54

2 Answers2

0
  1. Yes
  2. In php.ini like you thought. Use phpinfo(); to see what configuration files gets loaded. There could be additional php.ini files or this is not correct php.ini file loaded. Also, it can be easily changed from PHP code, .htaccess files etc.

In phpinfo() output, search for Loaded Configuration File and Additional .ini files parsed.

From command line, use command php -i to get php info.

Rene Korss
  • 5,414
  • 3
  • 31
  • 38
  • this is the output of phpinfo. As you see Loaded Configuration file is the one I mentioned and Additional .ini files parsed are none: Using ::::: for better readability Configuration File (php.ini) Path /Applications/XAMPP/xamppfiles/etc ::::: Loaded Configuration File /Applications/XAMPP/xamppfiles/etc/php.ini ::::::Scan this dir for additional .ini files (none) ::::::Additional .ini files parsed (none) – FBP Dec 31 '15 at 11:34
  • Then it gets changed somewhere else. This could be changed with [ini_set](http://php.net/manual/en/function.ini-set.php) etc. – Rene Korss Dec 31 '15 at 11:38
0

1) Is your understanding of the include_path correct?

Yes. The include_path is a list of directories separated with a colon in Unix or semicolon in Windows. http://php.net/manual/en/ini.core.php#ini.include-path

2) Where is the include_path set?

Where is the include_path set because I looked at my php.ini file in /Applications/XAMPP/xamppfiles/etc but I couldn't find this being mentioned in the file. This is what my php.ini had and the same seems to be commented:

; UNIX: "/path1:/path2"
;include_path = ".:/php/includes"

In a nutshell, your version of PHP was compiled with a default include_path of .:/Applications/XAMPP/xamppfiles/lib/php. If there is no value for an ini setting PHP will fallback to its default.

Note: In ini files, lines beginning with ; are comments.

Community
  • 1
  • 1
Gerard Roche
  • 6,162
  • 4
  • 43
  • 69