Jump to content

[SOLVED] Can't access my PHP files through Apache.


Recommended Posts

OK, so I want to be able to run my own PHP files in Firefox without having to upload them to a web-server. I downloaded and installed Apache HTTP server 2.2.6, PHP5 and FastCGI 2.4.6. I configured PHP5 to work with Apache by editing the Apache config file (httpd.config) and adding the following lines:

 

Alias /fcgi-bin/ "c:/Program Files/PHP/"
FastCgiServer "c:/Program Files/PHP/php.exe" -processes 5
AddType application/x-httpd-fastphp .php
Action application/x-httpd-fastphp /fcgi-bin/php.exe

 

I included to the FastCGI extension with Apache by adding this line to the LoadModule section of the Apache config file:

 

LoadModule fastcgi_module modules/mod_fastcgi-2.4.6-AP22.dll

 

I used  the "Test Configuration" program to check the config file and it said there were no errors.

 

Apache is set up for localhost as I will only use it to test websites on my computer.

 

I created a PHP file to test "hello.php", all it does is echo "Hello" on the screen. I know it works because I uploaded to a free web-server and it executes.

 

However, whenever I try and execute the file through Firefox by accessing it through http://localhost/hello.php (the file is in the proper directory), I get an error message:

 

Forbidden

You don't have permission to access /fcgi-bin/php.exe/hello.php on this server.

 

How could I be forbidden from accessing my own PHP files when I can access all the other files on http://localhost/ without problems?

 

 

 

Link to comment
Share on other sites

You'd be better installing WAMP, which gets it all going nicely for you :)

 

Yeah it'd be nicer to have them all managed at once rather than have to set them up all manually. It's just the PHP book I am reading explains how to set them up manually to work with each other. No luck.

 

Thanks for the help.

Link to comment
Share on other sites

On Windows don't paths use backslashes (\)? Just a thought...

 

This is http:// which always uses forward slashes. When navigating through Windows Explorer you use backslashes.

 

That's to do with the web client, not the web server. It may not make a difference but surely it's worth a try?  :)

 

I use XAMPP for Windows but learning to install PHP/Apache could be good experience for the future!

Link to comment
Share on other sites

On Windows don't paths use backslashes (\)? Just a thought...

 

This is http:// which always uses forward slashes. When navigating through Windows Explorer you use backslashes.

 

That's to do with the web client, not the web server. It may not make a difference but surely it's worth a try?  :)

 

I use XAMPP for Windows but learning to install PHP/Apache could be good experience for the future!

 

I get a "Server not found" error from Firefox when I change it to a backslash.  :P

Link to comment
Share on other sites

On Windows don't paths use backslashes (\)? Just a thought...

 

This is http:// which always uses forward slashes. When navigating through Windows Explorer you use backslashes.

 

That's to do with the web client, not the web server. It may not make a difference but surely it's worth a try?  :)

 

I use XAMPP for Windows but learning to install PHP/Apache could be good experience for the future!

 

I get a "Server not found" error from Firefox when I change it to a backslash.  :P

 

I think he means in the config files

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.