Apache /var/www/html php pages setup

Posted on 2007-10-11
Last Modified: 2008-01-09
Hello all !!

I have several php pages arranged in folders and subfolders. I am using apache, php for the first time. I just did a test on apache and see a page called phpinfo.php properly. It is on /var/www/html.  however when i place my php pages directory in /var/www/html  and access a page in it,  it gives a forbidden error. i.e when i access /var/www/html/myapp/1/test.html   it gives a Forbidder error. i then placed test.html in /app folder directly instead of /app/1 and tested. same error. btw the second line says "you don't have permission to access /app/test.html on this server". i don't think it is permissions problem. Permissions are all set to 755. If you have any ideas on how to get this working, please let me know.
Question by:newbieexpert
    LVL 2

    Accepted Solution


    What Version of PHP are you using?
    What are the permission of the directory that it is in?
    Do you have suEXEC enabled?

    Try changing permission to 644 see what happens.

    to do this type in chmod 644 filenamehere.

    Author Comment

    Hi, the php version is 5.1.2. I changed the directory permissions from 755 to 644 using chmod app. No luck. to restate, /var/www/html/test.htm works fine but /var/www/html/app/test.html won't work and displays forbidden and 403 error on http://localhost/app/test.htm page.  

    I am not sure if suexec is enabled here. I searched a lot for suexec but didn't find much info about it on fedora+apache. Thank you

    Author Comment

    I have not found suEXEC on my system yet. and  /usr/local/apache/sbin/suexec doesn't exist...
    LVL 2

    Expert Comment

    What version of apache are you using?
    What are the permissions on the file?
    LVL 28

    Assisted Solution

    by:Jan Springer
    A couple of things:

    Directories should be chmod 755 (in general)
    Files should be chmod 644 (in general)

    You don't need suexec to run php pages.

    Do you have an .htaccess file denying you the ability to read the pages?
    Do you have a configuration entry in httpd.conf for the app directory denying you access?

    # cd /var/log/http
    # grep test.htm error*

    What do the errors specifically say?

    Author Comment

    i changed the permissions of the files in app directory to 644. and 755 to app directory..

    also ran this command found on the web ..

    chcon  -R  -h  -t  httpd_sys_content_t    /var/www/html/bcd

    i am not sure what resolved the 403 problem here...

    thanks both! appreciate it.


    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    Join & Write a Comment

    If you are running a LAMP infrastructure, this little code snippet is very helpful if you are serving lots of HTML, JavaScript and CSS-related information. The mod_deflate module, which is part of the Apache 2.2 application, provides the DEFLATE…
    In Solr 4.0 it is possible to atomically (or partially) update individual fields in a document. This article will show the operations possible for atomic updating as well as setting up your Solr instance to be able to perform the actions. One major …
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now