I spent a bit of time this morning setting up apache2 and php, things have changed in the newer versions of Linux.
The following will install apache and php.
1 2 3 4 5 |
apt-get update apt-get upgrade apt-get install apache2 php libapache2-mod-php php-mcrypt |
This will test if PHP is install and running on the command line.
1 2 3 4 |
php -r 'echo "\n\nYour PHP installation is working fine.\n\n\n";' Your PHP installation is working fine. |
This will check if the PHP modules are loaded in apache.
1 2 3 |
root@63ca6f2b2370:/# apachectl -M|grep php AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.6. Set the 'ServerName' directive globally to suppress this message php7_module (shared) |
Save the following file in the following location.
1 2 3 4 |
root@63ca6f2b2370:/# cat /var/www/html/index.php <?php phpinfo(); ?> |
restart apache
1 |
/etc/init.d/apache2 restart |
in your web browser navigate to
1 |
http://ipaddress/index.php |
You should see something like this.