[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Apache and PHP don't quite work




On Fri, May 23, 2003 at 11:46:39PM +0200, Roberto Sanchez wrote......

>  --- nate <debian-user@aphroland.org> escribió:
> > > 1.  I put this example code in an html file:
> > 
> > I'm not a php coder(or a coder in anything) but if you
> > embed a script doesn't it have to be a .shtml ?
> > try making it just a  .php file
> > 
> 
> Turning it into a .php file worked.  I was under the (mistaken) impression
> that because "PHP can be embedded in html," the browser would handle it
> correctly.  The .shtml thing didn't work, as the browser tried to download
> the file (it said the file was mime type text/x-server-parsed-html).
> 
> Why is it like that?  How do I make the index.html file redirect to the
> index.php file (can you tell I am totally new at this)?  That way I can
> enter http://localhost/ in my address bar and the get the correct PHP page?

Create your index.php page and just delete the index.html page.  Apache
should find the index.php page by default if there is not a index.html
page present in that directory.

Just to make sure, check your /etc/apache/httpd.conf file for a chunk of
code like this:

     # DirectoryIndex: Name of the file or files to use as a pre-written HTML
     # directory index.  Separate multiple entries with spaces.
     #
     <IfModule mod_dir.c>
         DirectoryIndex index.html index.htm index.shtml index.cgi index.php
     </IfModule>

As you can see, index.php is one of the default pages.

Kevin

Attachment: pgpMxjeWu97B1.pgp
Description: PGP signature


Reply to: