Make sure that you’re activating the modules by creating php module configuration files in the right sub directory, e.g. /etc/php7/..
. Due to the fact that the directory can differ depending on the used distribution and you didn’t provide any information about your environment, I recommend to use the search function of this forum to find an answer or to ask aunt G. for help.