PHP "last updated"

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Blazeix
Forum Newbie
Posts: 3
Joined: Thu Aug 10, 2006 11:05 am

PHP "last updated"

Post by Blazeix »

Hi. I'm trying to get a 'last updated' PHP script on my website. I have the following embedded at the bottom of my main page, index.html.

Code: Select all

<?php
echo "Last modified: ".date("F d Y H:i:s.",filemtime("index.html"));
?>
When I view the page, there is nothing, no error message or anything. PHP is enabled on the server; other php scripts work fine.

Here is a link to the page where the php script is located. It should appear at the bottom of the page, on the orange bar. I was wondering if it was a permissions problem. Can anyone help? Thanks.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

The server is not cofigured to let php handle this request.
When I open the sourcecode view of my browser, there is

Code: Select all

<div id="bttmbar">
<span id="updated">
<?php
echo "Last modified: ".date("F d Y H:i:s.",filemtime("index.html"));
?> 
</span>
</div><!-- end of bttmbar -->
Blazeix
Forum Newbie
Posts: 3
Joined: Thu Aug 10, 2006 11:05 am

Post by Blazeix »

How can I configure it? when I have to code alone in a php file in the same directory, it works, (here) but when I put it in index.html, it doesn't.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

The server responses with
Server: Apache/2.0.40 (Red Hat Linux)
Therefore: http://de2.php.net/manual/en/install.unix.apache2.php
15. Tell Apache to parse certain extensions as PHP. For example,
let's have Apache parse the .php extension as PHP. You could
have any extension(s) parse as PHP by simply adding more, with
each separated by a space. We'll add .phtml to demonstrate.

AddType application/x-httpd-php .php .phtml
Blazeix
Forum Newbie
Posts: 3
Joined: Thu Aug 10, 2006 11:05 am

Post by Blazeix »

Thanks. I don't have access to changing settings on the server, but I renamed my index.html to index.php, and now its working. Thank!
Post Reply