Where is "./" in php.ini extensions directory pointing to?
I don't want to look like a noob, but this is really annoying me. 开发者_如何学编程Do you know where does the
; Directory in which the loadable extensions (modules) reside. extension_dir = "./"
pointing to?
./
points to the current directory.
Edit
I haven't found any definition of what the current directory is while parsing a php.ini
file, this post suggests that it is relative to the php.ini
files location.
Just adding in for future searches
Running phpinfo
on the cli (php -a<enter>phpinfo();<enter>)
gave me this among the output.
extension_dir => /usr/lib/php/20131226 => /usr/lib/php/20131226
It appears that "current directory" is, as far as PHP is concerned, whatever directory "pwd" prints.
The easiest way to see this is to run php -r 'echo getcwd();'
I can also determine this is by typing zend_extension="xdebug.so"
inside my php.ini . Next, I create two folders anywhere: One empty, and the other I copy my xdebug.so into.
When I open a terminal inside my empty folder and run php
, it generates a warning about not being able to find xdebug.so. In contrast, if I open the terminal in the folder with the extension and run php at the prompt, there are no warnings.
I couldn't determine where this maps to when running php through apache. I tried the document root, HTTPD_ROOT, /usr/bin. Nothing. I'm making this note incase someone who knows more about apache can shed some light on this.
As far as, extension_dir's default location. That is compiled in. You can find the value for your extension_dir by finding the file build-defs.h.
It's defined in the macro PHP_EXTENSION_DIR
build-defs.h is created by a template file during the configure stage of compilation.
精彩评论