PHP with Linux FAP [merged]

Whether you are using Linux on the desktop or as a server, it's still good that you're using Linux. Linux related questions go here.

Moderator: General Moderators

Post Reply
kapil1089theking
Forum Commoner
Posts: 46
Joined: Wed May 28, 2008 1:51 pm
Location: Kolkata, India
Contact:

PHP with Linux FAP [merged]

Post 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....
kapil1089theking
Forum Commoner
Posts: 46
Joined: Wed May 28, 2008 1:51 pm
Location: Kolkata, India
Contact:

FAP problem with /var/www/html

Post 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
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: PHP with Linux FAP

Post 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.
kapil1089theking
Forum Commoner
Posts: 46
Joined: Wed May 28, 2008 1:51 pm
Location: Kolkata, India
Contact:

Re: PHP with Linux FAP

Post 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)?
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: PHP with Linux FAP

Post 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!
User avatar
Kieran Huggins
DevNet Master
Posts: 3635
Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:

Re: FAP problem with /var/www/html

Post 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
kapil1089theking
Forum Commoner
Posts: 46
Joined: Wed May 28, 2008 1:51 pm
Location: Kolkata, India
Contact:

Re: PHP with Linux FAP

Post 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?
kapil1089theking
Forum Commoner
Posts: 46
Joined: Wed May 28, 2008 1:51 pm
Location: Kolkata, India
Contact:

Re: FAP problem with /var/www/html

Post 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?
User avatar
Kieran Huggins
DevNet Master
Posts: 3635
Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:

Re: FAP problem with /var/www/html

Post by Kieran Huggins »

use "chmod" to allow world read access.
kapil1089theking
Forum Commoner
Posts: 46
Joined: Wed May 28, 2008 1:51 pm
Location: Kolkata, India
Contact:

Re: FAP problem with /var/www/html

Post by kapil1089theking »

plz help me with chmod
even if i Do
chmod 777 -R /var/www/html/

It doesnt work.
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: PHP with Linux FAP

Post 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.
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Re: FAP problem with /var/www/html

Post by Benjamin »

Do NOT post duplicate threads. You have this same topic posted in General Discussion.
Post Reply