2

I just installed a fresh ubuntu system from here (mini.iso) I choosed no extras at all during the installation process.

These are all the commands which I have executed this far: (Ignore 4 - 8) enter image description here

Now I wrote a simple PHP test script (/var/www/html/index.php)

<?php

echo "Hello World";

?>

However, after calling this page from another computer, I literally get the output from the file, instead of the compiled php.

Output:

<?php

echo "Hello World";

?>

I have already restarted apache2, no change.

Apache version:

Server version: Apache/2.4.7 (Ubuntu)
Server built:   Jul 15 2016 15:32:47

PHP version:

PHP 7.0.16-4+deb.sury.org~trusty+1 (cli) (built: Mar  2 2017 13:50:00) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
    with Zend OPcache v7.0.16-4+deb.sury.org~trusty+1, Copyright (c) 1999-2017, by Zend Technologies

Linux version:

Linux linux 3.13.0-110-generic #157-Ubuntu SMP Mon Feb 20 11:55:25 UTC 2017 i686 i686 i686 GNU/Linux

I already searched the internet, some other user sayed to check if the PHP module is loaded by checking the file httpd.conf, but there is no such file. I searched it by using find / -name "httpd.conf" which gave no results.

Black
  • 18,150
  • 39
  • 158
  • 271

1 Answers1

6

You need to install PHP apache2 module to work with PHP. You can install libapache2-mod-php from your terminal by typing the command

sudo apt-get install libapache2-mod-php

After that restart your apache. It will solve your problem.

Shaharia Azam
  • 1,948
  • 19
  • 25
  • That solved the problem, thank you very much. Note: You don't have to restart the apache2 server, since this happens automatically during the installation. – Black Mar 07 '17 at 12:07