-1

my main WordPress page shows:

<?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('WP_USE_THEMES', true);

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

my platform: ubuntu 16.04 and I am using Apache. how can i solve this?

apache2 -M | grep php output:

[Mon Nov 13 06:58:35.785748 2017] [core:warn] [pid 20486] AH00111: Config variable ${APACHE_LOCK_DIR} is not defined
[Mon Nov 13 06:58:35.785929 2017] [core:warn] [pid 20486] AH00111: Config variable ${APACHE_PID_FILE} is not defined
[Mon Nov 13 06:58:35.786020 2017] [core:warn] [pid 20486] AH00111: Config variable ${APACHE_RUN_USER} is not defined
[Mon Nov 13 06:58:35.786087 2017] [core:warn] [pid 20486] AH00111: Config variable ${APACHE_RUN_GROUP} is not defined
[Mon Nov 13 06:58:35.786164 2017] [core:warn] [pid 20486] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Mon Nov 13 06:58:35.790530 2017] [core:warn] [pid 20486:tid 140021226223488] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Mon Nov 13 06:58:35.790931 2017] [core:warn] [pid 20486:tid 140021226223488] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Mon Nov 13 06:58:35.791163 2017] [core:warn] [pid 20486:tid 140021226223488] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
AH00526: Syntax error on line 74 of /etc/apache2/apache2.conf:
Invalid Mutex directory in argument file:${APACHE_LOCK_DIR}

sudo dpkg --get-selections | grep php output:

libapache2-mod-php              install
libapache2-mod-php7.0               install
php                     install
php-common                  install
php-curl                    install
php-gd                      install
php-gettext                 install
php-mbstring                    install
php-mcrypt                  install
php-mysql                   install
php-pear                    install
php-phpseclib                   install
php-tcpdf                   install
php-xml                     install
php-xmlrpc                  install
php7.0                      install
php7.0-cli                  install
php7.0-common                   install
php7.0-curl                 install
php7.0-gd                   install
php7.0-json                 install
php7.0-mbstring                 install
php7.0-mcrypt                   install
php7.0-mysql                    install
php7.0-opcache                  install
php7.0-readline                 install
php7.0-xml                  install
php7.0-xmlrpc                   install
phpmyadmin                  install

systemctl status apache2.service output:

* apache2.service - LSB: Apache2 web server
   Loaded: loaded (/etc/init.d/apache2; bad; vendor preset: enabled)
  Drop-In: /lib/systemd/system/apache2.service.d
           `-apache2-systemd.conf
   Active: failed (Result: exit-code) since Mon 2017-11-13 07:12:52 EST; 5min ago
     Docs: man:systemd-sysv-generator(8)
  Process: 20848 ExecStop=/etc/init.d/apache2 stop (code=exited, status=0/SUCCESS)
  Process: 19096 ExecReload=/etc/init.d/apache2 reload (code=exited, status=0/SUCCESS)
  Process: 20898 ExecStart=/etc/init.d/apache2 start (code=exited, status=1/FAILURE)

Nov 13 07:12:52 student apache2[20898]:  * The apache2 configtest failed.
Nov 13 07:12:52 student apache2[20898]: Output of config test was:
Nov 13 07:12:52 student apache2[20898]: [Mon Nov 13 07:12:51.996158 2017] [:crit] [pid 20909:tid 139772608190336] Apache is running a threaded MPM, but your PHP Module is not compiled to be threadsafe.  You need
Nov 13 07:12:52 student apache2[20898]: AH00013: Pre-configuration failed
Nov 13 07:12:52 student apache2[20898]: Action 'configtest' failed.
Nov 13 07:12:52 student apache2[20898]: The Apache error log may have more information.
Nov 13 07:12:52 student systemd[1]: apache2.service: Control process exited, code=exited status=1
Nov 13 07:12:52 student systemd[1]: Failed to start LSB: Apache2 web server.
Nov 13 07:12:52 student systemd[1]: apache2.service: Unit entered failed state.
Nov 13 07:12:52 student systemd[1]: apache2.service: Failed with result 'exit-code'.

1 Answers1

3

You must have php module installed with apache configuration. Try below command to install the same

sudo apt-get install php7.0 libapache2-mod-php7.0

then restart apache with below command

sudo service apache2 restart

Please note that your php version may change according to your Ubuntu distro.

UPDATE :

According to logs it seems you are changed default MPM to worker in apache configuration, and php module doesn't support threaded MPM. So you have to use php_fpm or mod_fcgid to execute php with threaded MPM otherwise switch apache to use prefork MPM.

Here you can get step by step details to install php-fpm https://www.howtoforge.com/tutorial/apache-with-php-fpm-on-ubuntu-16-04/

Vaibhav Panmand
  • 959
  • 5
  • 17