Need Help for Displaying PHP file on localhost- it shows an error- HTTP 403 forbidden

Hi there,
I am Tarjana. This is my first thread.

I have installed PHP 5.4, MySQL 5.5, Apache 2.2.22 on Windows 7.

I’ve followed the book “build your own database … by Kevin Yank, 4th edition” I made the required changes suggested by Author in one post during installaton.

Installation has gone well. It shows “http://localhost:8080” page but when I write first PHP file - with only echo statement, it shows “HTTP 403 forbidden”. It doesn’t show php file.

I need your help to resolve this issue please.

Thanks and Regards
Tarj

403 usually indicated permission errors. Check your CHMOD with the file.

Hi PromptSpace,
Thanks for your reply.

What I’ve done - right click file ->properties -> change permission ->full control

I’ve changed permissions in that file even it shows HTTP 403 error.

I tried much but now I need help in this.

Thanks

How are you accessing that page your wrote in your browser, ie what address do you go to?

The 403 error most likely means that you haven’t granted Apache permission to serve files from the directory you’re requesting files from.

You need a block like this in your httpd.conf to tell Apache it’s allowed to serve files from c:/path/to/my/php/files – which you should replace with your real path, i.e., the path that is set as DocumentRoot in httpd.conf


<Directory "c:/path/to/my/php/files">
    Order allow,deny
    Allow from all
</Directory>

… and DON’T use Window’s Program Files (or the users directory) for the location of your “website” files! That’s a protected directory and it will not work.

Regards,

DK

You also might want to check the PHP error log. Not sure where it would be in that apache setup.

If you are on win7 an easy way to get PHP running is to use the Web Platform Installer and install PHP on IIS. No need to mess with strange httpd.conf stuff . . .