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 directoryand 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)
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.
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
include_path
set?Where is the
include_path
set because I looked at myphp.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.