| Author | 
  | 
noone
 
 
  Joined: 07 Sep 2006 Posts: 3
 
  | 
 Posted: Thu 07 Sep '06 22:52    Post subject: Problem getting Apache 2.2 to recognize the .php extension | 
     | 
 
  | 
 
I've followed all the step outlined in http://www.apachelounge.com/viewtopic.php?t=570.  I've used all the downloads from here except for php 5.1.6 which came from php.net
 
 
I've created a file called test.php that contains:
 
 
<?phpinfo()?>
 
 
I have all this installed on my XP Pro SP2 laptop.  I try to check out test.php like this:
 
 
http://localhost/test
 
All I get is "404 Not Found"
 
 
If I try http://localhost/test.php
 
I get the php version info.
 
 
These lines are in my httpd.conf:
 
LoadModule php5_module "c:/php5/php5apache2.dll"
 
AddType application/x-httpd-php .php
 
AddType application/x-httpd-php .php-source .phps 
 
# configure the path to php.ini
 
PHPIniDir "C:/php5"
 
 
What must I do so Apache will recoginize the .php extension without having to explicitly add it each time?
 
 
Thanks! | 
 
  | 
| Back to top | 
 | 
Steffen Moderator
 
  Joined: 15 Oct 2005 Posts: 3131 Location: Hilversum, NL, EU
  | 
 Posted: Fri 08 Sep '06 1:05    Post subject:  | 
     | 
 
  | 
 
| Without a extension it is seen as a folder by Apache. In your case it is looking for the folder test in your webspace. | 
 
  | 
| Back to top | 
 | 
James Blond Moderator
  
  Joined: 19 Jan 2006 Posts: 7442 Location: EU, Germany, Next to Hamburg
  | 
 Posted: Fri 08 Sep '06 10:13    Post subject:  | 
     | 
 
  | 
 
you can set in httpd.conf
 
 	  | Code: | 	 		  
 
<Location /somefolder>
 
php_admin_value xbithack 1
 
</Location>
 
 | 	  
 
 
Be carefull! in that folder every file will beparsed by PHP! Do not put binary files in that folder!
 
 
http://127.0.0.1/somefolder/test | 
 
  | 
| Back to top | 
 | 
noone
 
 
  Joined: 07 Sep 2006 Posts: 3
 
  | 
 Posted: Fri 08 Sep '06 17:09    Post subject:  | 
     | 
 
  | 
 
| I've also noticed I can't get Apache to recognize .php as a valid extension.  For example, I renamed test.php to index.php.  I was expecting to see the php info screen, but all I got was a directory listing of the document root.  I thought Apache looks for index.html, index.htm or index.php by default. | 
 
  | 
| Back to top | 
 | 
James Blond Moderator
  
  Joined: 19 Jan 2006 Posts: 7442 Location: EU, Germany, Next to Hamburg
  | 
 Posted: Fri 08 Sep '06 17:13    Post subject:  | 
     | 
 
  | 
 
You can edit that with the index.* file     in the httpd.conf
 
 	  | Code: | 	 		  
 
DirectoryIndex index.php index.htm index.html
 
 | 	 
  | 
 
  | 
| Back to top | 
 | 
Steffen Moderator
 
  Joined: 15 Oct 2005 Posts: 3131 Location: Hilversum, NL, EU
  | 
 | 
| Back to top | 
 | 
noone
 
 
  Joined: 07 Sep 2006 Posts: 3
 
  | 
 Posted: Fri 08 Sep '06 20:52    Post subject:  | 
     | 
 
  | 
 
| Thanks for the help!  I can now get my Joomla test site up and running! | 
 
  | 
| Back to top | 
 |