Where is my php extension directory?

I'm trying to build a bash script to install the Source Guardian PHP extension however the destination directory is different on every subsequent release of Ubuntu.

Installing PHP5 on Ubuntu 14.04 results in the extensions being stored in /usr/lib/php5/20121212+lfs/, in Ubuntu 15.04 this directory changes, e.g. /usr/lib/20131226/

I've checked /etc/php5/fpm/php.ini and /etc/php5/fpm/php-fpm.conf but neither of these files has any mention of 20121212+lfs or 20131226.

If I place the Source Guardian extension anywhere else, it does not load.

Is there a way to programmatically determine the extension folder?

asked Feb 20, 2016 at 16:18

Where is my php extension directory?

IsometricIsometric

3211 gold badge2 silver badges6 bronze badges

Maybe you should do this:

php-config --extension-dir

If php-config doesn't exist, then apt-get install php-config if Ubuntu/Debian or yum install php-config if CentOS/Red Hat)

That command will give exact location of your php extension folder.

Don't forget to change your php.ini in order to use extensions.

Where is my php extension directory?

Jeff Schaller

64.2k33 gold badges104 silver badges235 bronze badges

answered Apr 25, 2016 at 18:04

2

You can use this

php -i | grep extension_dir

answered Sep 18, 2017 at 13:22

Where is my php extension directory?

1

You can search for the xdebug file extension: find $(php -r 'echo ini_get("extension_dir");') -type f -name 'xdebug.so'

Or just get the value: php -r 'echo ini_get("extension_dir");'

answered Mar 23, 2021 at 12:40

Where is my php extension directory?

You can find it as well by creating a phpinfo script (a file that invokes phpinfo();) and then run it in the browser.

See the example below.

Where is my php extension directory?

answered Apr 11, 2019 at 15:07

Where is my php extension directory?

JulianJulian

1113 bronze badges

Just wanted to add that although

php-config --extension-dir

would give you the extension directory but usually we modify some extension location in the active php.ini file. (there can be more than one php versions installed on the system at the same time. And current php.ini file location could be found by looking to the output of phpinfo function; using finding php.ini in the output of phpinfo function).

For example, xdebug might be located in the some other folder than the extension directory using the variable zend_extension; mostly located at the end of the php.ini file.

zend_extension=/usr/lib/php/20170718/xdebug.so

So be careful when replace module file in the directory; (had made be nuts once; because although i was changing the file but was not actually reflected in the output of phpinfo file).

answered Oct 22, 2020 at 8:45

Where is my php extension directory?

Loading or identifying extension directory of dll in windows

PHP stores all the dlls inside the extension directory in window system. The dlls are loaded from here ( the directory ) based on the setting of php.ini file. Many times one can get the error message saying extension not found. So after installation of PHP the best way to identify the extension directory is to open php info file and check for all the settings.

In the php info display it will be written where the extension file of the system is stored. It is also known as extension_dir . The picture below is the screen shoot of the php info display and the portion explaining the extension directory is shown.

Where is my php extension directory?
The php.ini file located inside windows folder ( or inside php folder ) can be edited to change the extension directory location. The location of php.ini file also can be collected from php info display. Inside the php.ini file there is a line saying like this.
; Directory in which the loadable extensions (modules) reside.
extension_dir = "c:\php_new\ext"
Change the above line to point to correct extension directory path. After showing the path inside php.ini file below the above line there will be all dlls listing and any dll can be added or removed by commenting or removing the comment before it. Here is some listing examples.
;extension=php_mcrypt.dll
;extension=php_mhash.dll
;extension=php_mime_magic.dll
;extension=php_ming.dll
;extension=php_mssql.dll
extension=php_msql.dll
extension=php_mysql.dll
extension=php_mysqli.dll

;extension=php_oci8.dll
;extension=php_openssl.dll
;extension=php_oracle.dll
;extension=php_pdf.dll
;extension=php_pgsql.dll
;extension=php_shmop.dll
You can see three .dlls are in use. The comments lines are removed. This is the way we add or remove extensions for PHP.

Checking extension loaded or not

We can check the status of the extension by using extension_loaded() function. Here is a sample code to check gd extension.
GD support is  loaded ";
}else{
echo "
GD support is NOT loaded "; } ?>
Note that these all are in window platform.
  • ini_loaded_file():Path of php.ini file
  • Introduction to PHP
  • Collect all PHP settings by phpinfo()

Where is my php extension directory?
Subscribe to our YouTube Channel here

This article is written by plus2net.com team. https://www.plus2net.com


Where is my php extension directory?

plus2net.com

How do I see PHP extensions?

If your server only has a single PHP version installed, you can run this PHP command anywhere, and it will give you the same list of modules. The general command we will be using is php -m. This command will give you the full list of installed PHP modules/extensions.

How can I see PHP extensions in cPanel?

How to manage PHP extensions on cPanel?.
On the newly opened page, select the Extensions tab:.
There you will able to see a list of extensions that can be enabled or disabled depending on your needs, just simply click on the checkmark to enable or disable it:.

What is the file extension of PHP?

php file extension refers to the name of a file with a PHP script or source code that has a ". PHP" extension at the end of it.

How do I enable PHP extensions in Windows?

Installing PHP Extensions on Windows ini file for your PHP installation, and open it in a text editor. Step 2: Locate the line that specifies the location of the “extension = ” line. Step 3: Look for the extension you want to install and remove the semicolon preceding that line.