logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Other Software View previous topic :: View next topic
Reply to topic   Topic: Problem getting Apache 2.2 to recognize the .php extension
Author
noone



Joined: 07 Sep 2006
Posts: 3

PostPosted: Thu 07 Sep '06 22:52    Post subject: Problem getting Apache 2.2 to recognize the .php extension Reply with quote

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: 3094
Location: Hilversum, NL, EU

PostPosted: Fri 08 Sep '06 1:05    Post subject: Reply with quote

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: 7373
Location: Germany, Next to Hamburg

PostPosted: Fri 08 Sep '06 10:13    Post subject: Reply with quote

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

PostPosted: Fri 08 Sep '06 17:09    Post subject: Reply with quote

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: 7373
Location: Germany, Next to Hamburg

PostPosted: Fri 08 Sep '06 17:13    Post subject: Reply with quote

You can edit that with the index.* file Wink in the httpd.conf
Code:

DirectoryIndex index.php index.htm index.html
Back to top
Steffen
Moderator


Joined: 15 Oct 2005
Posts: 3094
Location: Hilversum, NL, EU

PostPosted: Fri 08 Sep '06 17:13    Post subject: Reply with quote

See the Directoryindex directive:

http://httpd.apache.org/docs/2.2/mod/mod_dir.html#directoryindex

For example:
DirectoryIndex index.php index.html

Steffen
Back to top
noone



Joined: 07 Sep 2006
Posts: 3

PostPosted: Fri 08 Sep '06 20:52    Post subject: Reply with quote

Thanks for the help! I can now get my Joomla test site up and running!
Back to top


Reply to topic   Topic: Problem getting Apache 2.2 to recognize the .php extension View previous topic :: View next topic
Post new topic   Forum Index -> Other Software