I installed Ubuntu on VMWare (OS X) and followed the instructions to install LAMP on Ubuntu I also created a virtual host named 'cmsms23'. So the folder structure is:


I made the according conig file in /etc/apache2/sites-available/cmsms23.conf which contains:

<VirtualHost *:80>
ServerAdmin webmaster@cmsms23
ServerName cmsms23
ServerAlias cmsms23
DocumentRoot /var/www/cmsms23
<Directory /var/www/cmsms23>
    Options -Indexes +FollowSymLinks
    AllowOverride All
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined


If I enter 'php -version' the server response with:

PHP 7.2.24-0ubuntu0.18.04.1 (cli) (built: Oct 28 2019 12:07:07) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies with Zend OPcache v7.2.24-0ubuntu0.18.04.1, Copyright (c) 1999-2018, by Zend Technologies

If I make an html-file in the folder mentioned, that it executes according. However, if I want to display the phpinfo() via a simple php-file, than this file is not executed.

I search numerous site for a solution and tried several of them, but so far no luck. Anyone willing / able to help me out?

1 Answer 1


It looks like you are trying to use PHP in an HTML file. In my experience using apache2/httpd, to use ANY PHP, the file had to have a .php extension. The HTML still displayed fine, but PHP code wouldn't run for me unless I had a .php extension.

  • To clarify, the php code does have the php extension. The html code does have the html-extension. Dec 9, 2019 at 18:30
  • So all the files containing PHP code are .php?
    – Ecstasy
    Dec 9, 2019 at 19:18
  • Yes, all files do have the appropriate extension. Dec 10, 2019 at 14:49

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.