Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

My website that I use xenforo for stopped working and shows the apache2 test page.
Also the domain/admin.php does not load and shows the page including raw PHP code (rather then the results after interpreting the PHP code).

<?php
$startTime = microtime(true);
$fileDir = dirname(__FILE__);
require($fileDir . '/library/XenForo/Autoloader.php');
XenForo_Autoloader::getInstance()->setupAutoloader($fileDir . '/library');
XenForo_Application::initialize($fileDir . '/library', $fileDir);
XenForo_Application::set('page_start_time', $startTime);
$fc = new XenForo_FrontController(new XenForo_Dependencies_Admin());

What is wrong with it and how do I fix this?

share|improve this question
    
I disagree. The problem does not seem to be the code, but rather that it does not get parsed by PHP. Stack Overflow is about the code (which is fine). –  Hennes Sep 18 '13 at 22:33
    
Maybe I need to add some more. If I try to display a text file in a browser then I will usually see the results. If I try to display a HTML file then I will see the locally parsed results. (To verify that save index.html as index.txt and open it. You will see the raw HTML code as text). PHP does something similar but the parsing is done on the web-server. Except in the OP's case it does not work. So either the PHP installation on the server is broken, or it is not registered properly to Apache. –  Hennes Sep 18 '13 at 22:42

1 Answer 1

Your Apache configuration may have been reset.

You need to tell it to pass .php files to your PHP executable as a handler for .PHP extensions. This should give you the details and what you need to change.

Namely:

Tell Apache to parse certain extensions as PHP. For example, let's have Apache parse .php files as PHP. Instead of only using the Apache AddType directive, we want to avoid potentially dangerous uploads and created files such as exploit.php.jpg from being executed as PHP. Using this example, you could have any extension(s) parse as PHP by simply adding them. We'll add .php to demonstrate.

<FilesMatch \.php$>
 SetHandler application/x-httpd-php 
 </FilesMatch>

You also need to be sure Apache is loading your PHP module with this:

LoadModule php5_module modules/libphp5.so
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.