index.php code being displayed in my homepage.

January 26, 2018 141 views
WordPress Ubuntu 16.04

Ok now I am getting a weird error type,If i go to my homepage I am getting a php code,the code is
"
<?php
/**

  • Front to the WordPress application. This file doesn't do anything, but loads
  • wp-blog-header.php which does and tells WordPress to load the theme. *
  • @package WordPress */

/**

  • Tells WordPress to load the WordPress theme and output it. *
  • @var bool */ define('WPUSETHEMES', true);

/** Loads the WordPress Environment and Template */
require( dirname( FILE ) . '/wp-blog-header.php' );
"

what the heck is this suppose to mean? I am totally lost.I contacted the support team they told me to check this link http://thisinterestsme.com/php-displayed-in-browser/ and I did everything seems to be fine,Php is installed,I restarted apache many times,what else is missing? any help is appreciated.

Thank you.

1 Answer

For any one having this trouble this is what I did,

i)First Run this two code,

sudo apt-get install libapache2-mod-php
and
sudo service apache2 reload

ii)and after this if you get error like "Your PHP installation appears to be missing the MySQL extension which is required by WordPress." then run the next two commands(this is meant for php 7),

sudo apt-get install php5-mysqlnd-ms
and
sudo service apache2 reload

This should fix the problem.

Have another answer? Share your knowledge.