6

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?

3 Answers 3

4

./ 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.

Sign up to request clarification or add additional context in comments.

3 Comments

Thanks Anders, I kind of thought that, but I don't know if it's php.ini's current directory, or if it's something else's current directory, perhaps php engine file (i don't know if that's the term) or (most likely not) apache's... :S
That was a far more difficult question, I've updated my answer with a source but I haven't been able to verify it.
Hey Anders, I don't know if this is a good practice or not, but since changing the "ext = /." line to something else was breaking the other extensions (which I couldn't find anywhere). I ended up using the directory structure on the extension=/my/directory/structure/extension.so and it worked. Thanks for your help! :)
3

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

3 Comments

For easier use, try this: php -r 'phpinfo();' | grep extension_dir
Finding the directory is one thing, but understanding why it uses that one is still a bit mysterious to me (the value in php.ini is commented out by default). Mine happens to be in /etc/lib64/php/modules/, which is obviously a feature of the 64-bit architecture.
@cartbeforehorse Check out the bottom part of my answer and see if that answers your question.
0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.