11

I have mad a custom ini files in /etc/php/7.0/mods-available. how can I enable it. I have tried php5enmod, and php7enmod. none worked for me.

Thank you.

13

You can simply use the command phpenmod.

3
  • 3
    It would be more help if you provided details on how to explicitly use this command. – Kevin Bowen Dec 2 '16 at 4:34
  • 1
    My "phpenmod" is pointing to php5.6 when I'm running: sudo phpenmod oci8 ===> WARNING: Module oci8 ini file doesn't exist under /etc/php/5.6/mods-available – Marcelo Rodovalho Aug 22 '17 at 17:51
  • 2
    OFFICIAL MANUAL TOLD ME: usage: phpenmod [ -v ALL|php_version ] [ -s ALL|sapi_name ] module_name [ module_name_2 ] so i run phpenmod -v 7.1 -s apache2 soap version and SAPI you can know from /usr/lib/php/ – Vladimir Ch Jan 17 '18 at 13:53
4
  • phpenmod moduleName enables a module to php7 (restart apache after that sudo service apache2 restart)
  • phpdismod moduleName disables a module to php7 (restart apache after that sudo service apache2 restart)
  • php -m lists the loaded modules
3

If you have several php versions intalled you can also use this syntax:

phpenmod -v 5.6 <modulename>
phpenmod -v 7.1 <modulename>
...

That worked in my case because I have 7.0, 7.1, 7.2 and 7.3 installed, but because of requirements I have to run my apache2 with 7.2.

2
  • Thanks, lifesaver! – Glorious Kale Apr 28 '20 at 10:17
  • 1
    Glad I could help! It saved my life too when I learnt it :D – Mihail Minkov Apr 28 '20 at 17:27
1
  • To check available modules, run php -m - it's a content of /etc/php/yourPHPVersion/mods-available
  • Select module from the list and enable it (let's say you want to enable soap) phpenmod soap
  • Reload apache2 service apache2 reload or systemctl reload apache2 And you have a module enabled.

  • To disable the same module, run phpdismod soap, reload apache2 service apache2 reload

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.