The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Accessing folder protected via php

Discussion in 'General Discussion' started by jerome.chevreau, Aug 26, 2010.

  1. jerome.chevreau

    Joined:
    Aug 26, 2010
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    Hi there,
    i was wondering how can i open a folder via fsockopen which is password protected. I try many things but no success and i really want to try keeping a password on certain folder for my website.


    Thanks for any help.

    Regards,

    Jerome
     
  2. cPanelDavidN

    cPanelDavidN Integration Developer
    Staff Member

    Joined:
    Dec 17, 2009
    Messages:
    571
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Hi Jerome,

    I assume you're saying that the directory contains a .htaccess file that you which to authenticate against in order to have PHP file in that directory served/rendered in the browser. If that is the case, you should probably read this: PHP: HTTP authentication with PHP - Manual

    If you are just looking to have your PHP script read the contents of another directory (that has .htaccess), you should be able to to that no problem. It's a simple directory/file read as normal. It's only when you make a direct URL request for a resource in a directory with a .htaccess file that authentication is necessary. This is because PHP doesn't care about .htaccess files, but Apache does.

    Regards,
    -DavidN
     
  3. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,468
    Likes Received:
    196
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
Loading...

Share This Page