Jump to content

[SOLVED] Apache 2.2.6 + PHP 5.2 not rendering PHP files correctly


Khons

Recommended Posts

When I try to open index.php through localhost, all I get is the text that is on the page. The includes and CSS are completely ignored. It would appear that the PHP code is being ignored completely, despite Apache running without a problem and the PHP installation package having added itself to httpd.conf .

 

If it helps, I'm using Apache 2.2.6 with PHP 5.2.5 on Windows Vista.

 

Thanks in advance.

Link to comment
Share on other sites

The PHP installation will add in LoadModule directive in the httpd.conf file but will not add in the AddType to tell Apache to handle files with PHP extensions.  If you haven't already done so, add in the following to your httpd.conf file:

 

 

    # Add PHP support

    AddType application/x-httpd-php .php

 

Restart Apache then try your URL again.

 

Link to comment
Share on other sites

The PHP installation will add in LoadModule directive in the httpd.conf file but will not add in the AddType to tell Apache to handle files with PHP extensions.  If you haven't already done so, add in the following to your httpd.conf file:

 

 

    # Add PHP support

    AddType application/x-httpd-php .php

 

Restart Apache then try your URL again.

 

I added the line, restarted the server, same thing :(

 

When you say the text, do you mean the php code?
No, not the PHP code itself, but the basic text that is on the page. CSS objects, text links which are put on the page by using include, etc are not displayed.
Link to comment
Share on other sites

Check your web server log for errors and/or turn on full php error reporting in php.ini or a .htaccess file to get php to help you.

 

Post your code as it is likely that you are doing something in it that is preventing php from outputting anything (such as using short open tags <?)

Link to comment
Share on other sites

I checked the Apache log, but I can't see anything too obvious. I uploaded the error log to http://www.indigetesdii.org/stuff/apache/error.txt .

 

I turned on error reporting in php.ini but it tells me nothing when I try to open index.php. It just shows me the text on the page, and that's it.

 

The index.php file code is as follows, and can be seen in action at http://www.indigetesdii.org . Locally (Apache) I only see the "to-morrow, and to-morrow, (...) signifying nothing." text.

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

<html>

<head>
<? include "css.php" ?>
<title>indigetesdii.org :: humanity has failed</title>
</head>

<body>

<div id="bg1-index"></div>
<div id="bg2-index"></div>

<div id="header">
  <table width="100%" height="100%" border="0">
  <tr>
   <td width="100%" height="100%" align="center" valign="middle">
    <img src="id/img/indigetesdii.jpg" />
   </td>
  </tr>
</table>
</div>

<div id="main">
<p class="home">
  <b>
  To-morrow, and to-morrow, and to-morrow,<br />
  Creeps on this petty pace from day to day,<br />
  To the last syllable of recorded time;<br />
  And all our yesterdays have lighted fools<br />
  The way to dusty death. Out, out, brief candle!<br /><br />
  Life's but a walking shadow; a poor player,<br />
  That struts and frets his hour upon the stage,<br />
  And then is heard no more: it is a tale<br />
  Told by an idiot, full of sound and fury,<br />
  Signifying nothing. 
  </b>
</p>
</div>

<div id="menu">
<p class="menu-top">
  <b>HUMANITY HAS FAILED</b>
</p>

<p class="menu-bottom">
  ::
  <a href="id/index.php">home</a> ::
  <a href="id/news.php">news</a> ::
  <a href="id/releases.php">releases</a> ::
  <a href="id/media.php">media</a> ::
  <a href="mailto:[-removeme-]info@indigetesdii.org" target="_blank">contact</a> ::
  <a href="http://www.myspace.com/indigetesdii" target="_blank">myspace</a> ::
</p>
</div>

</body>
</html>

Link to comment
Share on other sites

Ah, I thought that "open tags" meant "unclosed" tags, rather than proper tags. That'll teach me not looking up things I think I still know from a few years ago - I totally forgot that <? was a short version... :-[

 

Thanks for all the help and advice. I'll be sure to double-check any new code I might add!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.