php and .htaccess problem

  • Joe Bloggs
  • Newbie
  • Newbie
  • Joe Bloggs
  • Posts: 7

Post 3+ Months Ago

Hi There

I’m pretty new to website design. I’ve got to grips with designing basic pages using Dreamweaver and can use SSI.

However, I have hit against a problem whilst trying to learn php.

First thing is, I’m wanting to use a perl based CMS to manage page content. This means I have to have a cgi-bin running on the site. But I also want to create pages using php - mainly to start learning php.

I’m coming up against a problem - as when I load a index.php page into the directory called ‘test’

Then navigate with browser to: domain/test/

Instead of the page loading - I get this:

Code: [ Select ]
Index of /test

Parent Directory    27-Nov-2009 10:53   - 
index.php        27-Nov-2009 10:34  10k 
  1. Index of /test
  2. Parent Directory    27-Nov-2009 10:53   - 
  3. index.php        27-Nov-2009 10:34  10k 


The above two being links - when I click on the index.php link - it loads the page. I want it to load the page automatically without having to create a url to: index.php

I suspect it is something to do with this .htaccess file below which is in the root of my server - I understand it needs to be there to serve files ending .shtml - which I am using quite a few of:

Is there a way to fix this so that when I navigate to: domain/test/

The index.php automatically loads?

Code: [ Select ]
Options +Includes
AddType text/x-server-parsed-html .html
AddType text/x-server-parsed-html .shtml
AddType text/x-server-parsed-html .htm
DirectoryIndex index.shtml index.html index.htm
Options +ExecCGI
AddType application/x-httpd-cgi .cgi
AddType application/x-httpd-cgi .pl
  1. Options +Includes
  2. AddType text/x-server-parsed-html .html
  3. AddType text/x-server-parsed-html .shtml
  4. AddType text/x-server-parsed-html .htm
  5. DirectoryIndex index.shtml index.html index.htm
  6. Options +ExecCGI
  7. AddType application/x-httpd-cgi .cgi
  8. AddType application/x-httpd-cgi .pl


I tried changing it to this below - but the whole site then returned a 500 error:

Code: [ Select ]
Options +Includes
AddType text/x-server-parsed-html .html
AddType text/x-server-parsed-html .shtml
AddType text/x-server-parsed-html .htm
AddType text/x-server-parsed-html .php
DirectoryIndex index.shtml index.php index.html index.htm
Options +ExecCGI
AddType application/x-httpd-cgi .cgi
AddType application/x-httpd-cgi .pl
  1. Options +Includes
  2. AddType text/x-server-parsed-html .html
  3. AddType text/x-server-parsed-html .shtml
  4. AddType text/x-server-parsed-html .htm
  5. AddType text/x-server-parsed-html .php
  6. DirectoryIndex index.shtml index.php index.html index.htm
  7. Options +ExecCGI
  8. AddType application/x-httpd-cgi .cgi
  9. AddType application/x-httpd-cgi .pl


Any help or advice much appreciated.

Thanks
  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13504
  • Loc: Florida

Post 3+ Months Ago

What you are seeing is the result of mod_autoindex and a missing DirectoryIndex directive relating index.php as a file to be considered a default to send back.

It looks like you've already got the DirectoryIndex thing going in your code there, so I'm guessing the error has something to do with your AddType directive.

Do you know where the error log for that site is ?
Somewhere toward the end of your log there should be a clue for that 500 error.
  • Joe Bloggs
  • Newbie
  • Newbie
  • Joe Bloggs
  • Posts: 7

Post 3+ Months Ago

Thanks for trying to help me.

I changed it to this and it seems to be working now. don't know why tho.. but It’s done the trick.



Code: [ Select ]
Options +Includes
AddType text/x-server-parsed-html .html
AddType text/x-server-parsed-html .shtml
AddType text/x-server-parsed-html .htm
DirectoryIndex index.php index.shtml index.html index.htm
Options +ExecCGI
AddType application/x-httpd-cgi .cgi
AddType application/x-httpd-cgi .pl
  1. Options +Includes
  2. AddType text/x-server-parsed-html .html
  3. AddType text/x-server-parsed-html .shtml
  4. AddType text/x-server-parsed-html .htm
  5. DirectoryIndex index.php index.shtml index.html index.htm
  6. Options +ExecCGI
  7. AddType application/x-httpd-cgi .cgi
  8. AddType application/x-httpd-cgi .pl



Thanks again!
  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13504
  • Loc: Florida

Post 3+ Months Ago

Well, the usual type associated with PHP is "application/x-httpd-php". Perhaps PHP syntax is actually a syntax error for the interpreter associated with x-server-parsed-html.

Post Information

  • Total Posts in this topic: 4 posts
  • Users browsing this forum: No registered users and 78 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.