|
Posted by Andrew DeFaria on 11/16/05 04:14
Jim Carlock wrote:
> I have a couple easy questions possibly.
>
> 1) Is there a default.php page? The webserver seems to support
> default.htm, default.html, index.htm and index.html. It's an Apache
> server, I'd like to know if a default.php exists, or how to set it.
Same way you set default.htm, default.html, index.htm and index.html! ;-)
BTW: Aside from perhaps Win 9X, filenames can have more than 3 character
extensions so personally I'd nix the .htm's. Also default.html is an
IIS'ism and IMHO has no place in Apache!
Seriously though, assuming PHP is configured simply add it to the list
of DirectoryIndex in your httpd.conf file and restart Apache.
> 2) I'm getting some some strange results...
>
> My doctype.php file contains:
>
> <?php
> $sDoc='<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\r\n<html>\r\n<head>\r\n';
> ?>
>
> My html file contains:
>
> <?php
> require('static/doctype.php');
> echo($sDoc);
> ?>
>
> The file is named default.htm. The HTLM presents.
>
> <?php
> require('static/doctype.php');
> echo($sDoc);
> ?>
> <!--
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <html>
> -->
>
> So it appears either I need to tell PHP to process html, htm files or
> I need to find a way to set the apache server to use a default.php or
> whatever. Is that correct?
HTML files are for static content. PHP files (indicated by a suffix of
..php) can contain PHP code. You don't want to be making Apache parse all
your .html files looking for PHP! You want Apache to only consider .php
files as having PHP.
> Pagenames with a ".php" extension do work. Thanks much.
Ah, so then PHP is not set up with your Apache server then. IOW if you
browse to http://<host>/<somefile>.php and you have some real executable
PHP in there (let's say just an echo "Hi mom!") you are not just seeing
"Hi mom!". That's a different issue that brings up more questions like
where are you running Apache? What version? Have you installed PHP? Have
you configured Apache to know about PHP? etc.
Navigation:
[Reply to this message]
|