Embora existam muitos módulos instalados no sistema. Php usará os que estão realmente habilitados na configuração do Apache2. Dessa forma, você escolhe qual deles será usado, não instalando e desinstalando-os, mas, na verdade, permitindo que o que você anda seja eficaz no momento.
Você precisa ativar os módulos instalados para que eles sejam usados com o Apache2.
Use este comando:
$ sudo a2enmod [module-name]
Depois de ativar um módulo, certifique-se de reiniciar o servidor Apache2:
$ sudo service apache2 restart
Atualização:
Existe um conflito entre a versão da diferença dos módulos bcmath instalados. Execute estas etapas para resolver o problema.
$ sudo apt install apache2 libapache2-mod-php
$ cd /etc/apache2/sites-available/
$ sudo cp 000-default.conf ospos.conf
$ sudo a2ensite ospos.conf
$ sudo nano ospos.conf
Modifique seu novo VirtualHost
Alterar de:
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHos>
Altere para:
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
ServerName mysite.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/ospos/public
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
Por favor, note que o nome mysite.com é o nome do URL que você está digitando para abrir seu site. Adicione este nome do site ao seu arquivo /etc/hosts com:
127.0.1.1 mysite.com
Agora pare seu servidor apache2 com:
$ sudo systemctl stop apache2
Execute isto para verificar se nada está sendo executado na porta:
$ sudo lsof -i tcp:80 | egrep LISTEN
Agora inicie o servidor com:
$ sudo systemctl restart apache2
Você não poderá acessar seu site pelo URL sitename que você adicionou ao seu arquivo ospos.conf .