Page 1 of 1
PHP with Linux FAP [merged]
Posted: Sat Jun 21, 2008 5:24 pm
by kapil1089theking
Merged two overlapping topics. -Moderator
I have a folder named cs in /var/www/html/ which contains html files namely index.html
now if i point the browser to
http://127.0.0.1/cs/index.html
OUTPUT:
Code: Select all
Forbidden
You don't have permission to access /cs/index.html on this server.
Apache/2.2.0 (Fedora) Server at 127.0.0.1 Port 80
this works good for any file in /var/www/html/
I am unable to solve this problem, can anybody help me....
FAP problem with /var/www/html
Posted: Sat Jun 21, 2008 5:29 pm
by kapil1089theking
I can easily access any file like index.html in /var/www/htm/ by pointing the browser to
http://127.0.0.1/cs/index.html
but I am unable to see the page in /var/www/html/cs/ namely index.html by pointing the browser to
http://127.0.0.1/cs/index.html
OR
http://127.0.0.1/cs/
It says:
Code: Select all
[size=200]Forbidden[/size]
You don't have permission to access /cs/index.html on this server.
Apache/2.2.0 (Fedora) Server at 127.0.0.1 Port 80
Re: PHP with Linux FAP
Posted: Sat Jun 21, 2008 5:38 pm
by califdon
What is Document Root in your httpd.conf file for Apache? The server can only access files in Document Root and subdirectories. If that's not the problem, it could be access permissions.
Re: PHP with Linux FAP
Posted: Sat Jun 21, 2008 5:45 pm
by kapil1089theking
How can i check out the Document Root in my httpd.conf file for Apache? How can I modify that if I want to use/access all subdirectories(recursively)?
Re: PHP with Linux FAP
Posted: Sat Jun 21, 2008 6:37 pm
by califdon
kapil1089theking wrote:How can i check out the Document Root in my httpd.conf file for Apache? How can I modify that if I want to use/access all subdirectories(recursively)?
Edit httpd.conf with Notepad (NOT Word!). Find the line that defines "Document Root". Change it if you need to. httpd.conf is a plain text file that consists mainly of instructions (comments). Use Notepad's "Find" (Control+F) to search for "Document Root".
It's a good idea to save a backup copy of httpd.conf before you make any changes to it!
Re: FAP problem with /var/www/html
Posted: Sat Jun 21, 2008 6:40 pm
by Kieran Huggins
FAP? What kind of files are in this subdirectory??
Anyway... check your folder permissions - I'll bet they're not readable by the "apache" user
Re: PHP with Linux FAP
Posted: Sat Jun 21, 2008 6:45 pm
by kapil1089theking
yes got it
DocumentRoot "/var/www/html"
Does it mean that i can access any file in another folders in /var/www/html/ namely cs by pointion the browser
http://127.0.0.1/cs/index.html
If not then what to modify and to what?
Re: FAP problem with /var/www/html
Posted: Sat Jun 21, 2008 6:48 pm
by kapil1089theking
How can i give that permission to the apache user?
I am working with root
The file/folder owner and group is root
do i need to change it to apache user and apache group or root user and root group is better?
Re: FAP problem with /var/www/html
Posted: Sat Jun 21, 2008 6:53 pm
by Kieran Huggins
use "chmod" to allow world read access.
Re: FAP problem with /var/www/html
Posted: Sat Jun 21, 2008 7:21 pm
by kapil1089theking
plz help me with chmod
even if i Do
chmod 777 -R /var/www/html/
It doesnt work.
Re: PHP with Linux FAP
Posted: Sat Jun 21, 2008 7:59 pm
by califdon
kapil1089theking wrote:yes got it
DocumentRoot "/var/www/html"
Does it mean that i can access any file in another folders in /var/www/html/ namely cs by pointion the browser
http://127.0.0.1/cs/index.html
If not then what to modify and to what?
Yes, that's essentially correct. I assume that you are running Linux and that your cs/ directory has permissions for whatever "user" is running Apache (usually "nobody") and that there is
not a file in cs/ directory with the name ".htaccess" (which is a special file with which you can limit access to subdirectories and cause the browser to ask for a username and password). And, of course, that you actually have a file in the directory with the name "index.html".
The concept of Document Root is that Apache cannot "see" anything "outside" of that directory. This provides a measure of security for other files on your system. But it should be able to "see" all subordinate directories, providing that they have appropriate permissions and are not protected with an .htaccess file.
Re: FAP problem with /var/www/html
Posted: Sat Jun 21, 2008 8:00 pm
by Benjamin
Do NOT post duplicate threads. You have this same topic posted in General Discussion.