简体   繁体   中英

Enable PHP extension for Apache instead CLI

I'm building a bootstrap.sh file for a Vagrant setup and I need a simple way (bash command if possible) to enable a few extensions of PHP but when I run phpenmod it enable the extension for /etc/php/7.x/cli/php.ini but I want to enable in /etc/php/7.x/apache2/php.ini .

What should I do?

Take a look at the options:

$ phpenmod
WARNING: 
usage: phpenmod [ -v ALL|php_version ] [ -s ALL|sapi_name ] module_name [ module_name_2 ]

You can use -s sapi_name to choose which SAPI to enable an extension for, so phpenmod -s apache2 <extname> should do it.

Although, the default should be ALL , so I don't see why it hasn't worked for you so far without this. Maybe you forgot to restart Apache or PHP-FPM before checking if the extension is enabled? Double-check.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM