Hi All,

I have installed Apache 2.2.11 (using the installer exe) and PHP 5.2.9-1 (by unzipping the Zip file) in my local machine (Windows XP SP2).
To make these work with each other, i've edited the httpd.conf file by adding the below lines of code:

LoadModule php5_module "c:/php /php5apache2_2.dll "
AddType application/x-httpd-php .php .php5
PHPIniDir "c:/php"

And also edited the php.ini (after renaming the php.ini-dist file) in 4 places as below:

doc_root = "C:\Program Files\Apache Software Foundation\Apache2.2\htdocs"
extension_dir = "C:\php\ext"
extension=php_mysql.dll (removed the semicolon which was present earlier)
extension=php_mysqli.dll (removed the semicolon which was present earlier)

Apache server is running fine. I could see "It Works" message when run http://localhost

To test the PHP & Apache configuration, i have created a test.php file with the below code:
<?php
phpinfo();
?>
and placed this file in the path "C:\Program Files\Apache Software Foundation\Apache2.2\htdocs"

But, when accessed http://localhost /test.php , i'm getting "HTTP 404 Not Found".
I have searched various tutorials for confuguring this and after doing all the process the error remains same.
I have spent lot of hours trying to solve this, but in vain.

Attached herewith the php.ini file and the httpd.conf file for reference.

Please help...

Looking Forward,
Srinivas

    Well that's odd. Couple things to try:

    1. I can't remember the difference offhand, but try changing the 'AddType application/x-httpd-php' line in your httpd.conf file to 'AddHandler application/x-httpd-php' instead.

    2. If you make a normal HTML or TXT file in the htdocs folder, can you access those via your browser?

    3. When you try to access a PHP file, can you look in Apache's error logs and show us the relevant line(s)?

    EDIT: Just to ask the obvious... did you restart Apache after making the changes to the httpd.conf file?

      Dear Brad,

      Thanks for your inputs.

      I have tried with addhandler but no luck.
      I have made .php file only in htdocs but not a txt or html file.

      Below is the message i've seen when tried to access the php file from my browser:

      [Sun Apr 05 13:02:52 2009] [error] [client 127.0.0.1] script 'C:/Program Files/Apache Software Foundation/Apache2.2/htdocs/test.php' not found or unable to stat

      Yes, i have restarted the apache server after editing the httpd.conf file.

      Looking Forward,
      Srinivas

        Okay, well Apache is clearly unable to locate the file where you claim it is.

        Are you sure that the file is named "test.php" ? How did you create the file? Did you right-click inside the folder, point to New, and select Text Document, then changed the name to test.php ? If so, try going to http://localhost/test.php.txt and see if that loads.

          The problem is that Windows is hiding file extensions for known file types. It's basically a working-with-files-for-dummies approach; Windows doesn't think you know what a file extension is therefore it hides them from you allowing you to change only the name of the file.

          To disable this, follow these steps:

          1. Open My Computer.

          2. On the Tools Menu, select Folder Options.

          3. Click the View tab at the top.

          4. In the middle, under Advanced settings, look at the bottom of the visible list (e.g. don't scroll down at all, just look at the last option you can currently see) - it should be called 'Hide extensions for known file types.' Uncheck this box.

          5. Click the OK button.

          Now, go back to your htdocs folder and you should now see that the PHP file isn't called test.php but rather test.php.txt - rename this file appropriately and try accessing test.php in your browser again.

            Write a Reply...