Loading...


Related Products


Date Published: September 27, 2023

Include PHP Extensions on the Command Line When Running Drush

If you have compiled a PHP extension and it is enabled on your environment, it will not be available to PHP on the command line. To make it available, you need to preface your commands by adding an additional path to scan for php.ini files.
For example:
PHP_INI_SCAN_DIR="$PHP_INI_SCAN_DIR:/var/www/site-php/site.env/" drush php-eval "phpinfo();"
Important: Replace site.env with your application name and the environment you are running this on. This will scan the php.ini that has your extension enabled.

The alternative is to place a php.ini file in the "current directory" of where you run Drush. You'd only really be able to do this in your home directory, as nowhere else is writable. It would need to contain the following (again, replace the example parts as needed):
extension = /var/www/html/site.env/library/extension-path/extension-name.so
If you go this route, you would need to run Drush from your home directory for this to work, but you would not need to preface it with PHP_INI_SCAN_DIR (and so on).

Did not find what you were looking for?

If this content did not answer your questions, try searching or contacting our support team for further assistance.

Back to Section navigation
Back to Site navigation