0

I have been having problems with Apache2 loading php. First it printed raw code to the screen. Then I ran sudo apt-get install php libapache2-mod-php and sudo a2enmod mpm_prefork && sudo a2enmod php7.0. The 2nd command appeared to be unneeded but the 1st moved the issue forward slightly.

Running this test file in the browser (from /var/www/html):

// http://localhost/test.php
<?
phpinfo();

shows this:

1024) //{ // $bandwidth = round($bandwidth / 1024 , 2); 
// $bandwidth .= " MB"; //} //else //{ // $bandwidth .= " KB";
 //} // //switch (@$_GET['download']) { //case 'resume_speed':
 //case 'noresume_speed': //case 'resume': //case 'noresume': 
// $object->set_byfile($FILENAME); // if ($_GET['download'] == 
'noresume' || $_GET['download'] == 'noresume_speed') 
$object->use_resume = false; // if ($_GET['download'] ==
 'resume_speed' || $_GET['download'] == 'noresume_speed' )
 $object->speed = 100; // $object->download(); //break; 
//case 'data': //case 'dataresume': // $data = implode('' ,
 file($FILENAME)); // $object->set_bydata($data); // if 
($_SERVER['download'] != 'dataresume') $object->use_resume = 
false; // $object->filename = basename($FILENAME); 
// $object->download(); //break; //case 'auth': 
// $object->set_byfile($FILENAME); // $object->use_auth = 
true; // $object->handler['auth'] = "test_auth"; // $object-
>download(); //break; //case 'url': // $object-
>set_byurl('http://www.php.net/get/php_manual_chm.zip/from/cr.
php.net/mirror'); // $object->download(); //break; //} // //if 
($object->bandwidth > 0) //{ // error_reporting(E_NONE); // $b 
= intval(implode('',file('bandwidth.txt'))) + $object-
>bandwidth; // $f = fopen('bandwidth.txt','wb'); // 
fwrite($f,$b); // fclose($f); // exit; //} // //function 
test_auth($user,$pass) { //test authentication function // if 
($user == 'user' && $pass == 'pass') return true; // return
false; //} // //?> -->

Black text on white background. No formating.

Going to the root of a wordpress directory (with an index.php file) shows this (black text white background):

<?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' );

I've tried to remove/purse and install both apache2 and php several times. I also tried stopping and restarting the apache2 service.

Does anyone know what the issue could be?

Here are my versions:

owner@G700:/var/www/wptest1$ apache2 -v
Server version: Apache/2.4.29 (Ubuntu)
Server built:   2018-10-10T18:59:25

owner@G700:/var/www/wptest1$ php -v
PHP 7.2.15-0ubuntu0.18.04.1 (cli) (built: Feb  8 2019 14:54:22) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.2.15-0ubuntu0.18.04.1, Copyright (c) 1999-2018, by Zend Technologies

I'm on Lubuntu 18.04

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.