• xampp
  • how to know which extentions directory is loaded by xmapp php

how to know which extentions directory is loaded by xmapp php

root@ip-184-168-122-73:/opt/lampp/lib/php/extensions# pwd
/opt/lampp/lib/php/extensions
root@ip-184-168-122-73:/opt/lampp/lib/php/extensions# ls
no-debug-non-zts-20190902 no-debug-non-zts-20220829

how to know which directory is loaded by xmapp php

To determine which directory is being used by XAMPP's PHP to load extensions, you can check the extension_dir setting in the PHP configuration. Here's how to find it:


1. Check Using the PHP Command Line

Run the following command to check the extension_dir value:

/opt/lampp/bin/php -i | grep extension_dir

This will output something like:

extension_dir => /opt/lampp/lib/php/extensions/no-debug-non-zts-20220829

The directory shown is the one being used by XAMPP's PHP to load extensions.


2. Check via phpinfo()

  1. Create a PHP file to display PHP configuration:

       echo "<?php phpinfo(); ?>" > /opt/lampp/htdocs/phpinfo.php
  2. Access this file in your browser:

       http://localhost/phpinfo.php
  3. Look for the extension_dir setting under the Core section. It will show the directory path.


3. Ensure php.ini Points to the Correct Directory

To ensure the correct extension_dir is configured:

  1. Open the XAMPP php.ini file for editing:

       sudo nano /opt/lampp/etc/php.ini
  2. Search for extension_dir by pressing Ctrl + W and typing:

       extension_dir
  3. Verify or update the directory to match your setup:

       extension_dir = "/opt/lampp/lib/php/extensions/no-debug-non-zts-20220829/"
  4. Save the file and restart XAMPP:

       sudo /opt/lampp/lampp restart

4. Verify the Loaded Directory

After configuring and restarting, verify the loaded directory again using:

/opt/lampp/bin/php -i | grep extension_dir

Let me know if you need further assistance!