SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    SitePoint Member djrob's Avatar
    Join Date
    Sep 2000
    Location
    Melbourne
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi all,
    I have a number of .html pages in my public directory that are periodically updated from .php3 pages, that reside in another directory, below the public one.
    This is acheived via an 'update' button on an administration page, that also resides in the directory below the public directory.
    The good news - this all works a treat!

    The bad news - when I added a .htaccess file to the 'management' directory, the update page could no longer find the .php3 files ! I get an 'fopen warning - file does not exist' type of error. When .htaccess is renamed, it works perfectly again. I can't figure it out by changing absolute path names and so on - any ideas???

  2. #2
    SitePoint Wizard edshuck's Avatar
    Join Date
    Jul 2000
    Posts
    1,200
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hi

    i use the same protection. when i protected mine all i did was create a directory, protect it and then ftp the files i wanted protected into the new directory.

    for my application, all the files are php and do not update Semi-Dynamic pages.

    but this sounds like the php files are not finding the files they are to update now that they are in different directories.

    when you get a chance to take a look, add a not and let us know what worked. this would be most useful for me, and others also, if i, or they, later include the same feature.




    [Edited by edshuck on 10-26-2000 at 04:25 PM]

  3. #3
    SitePoint Evangelist
    Join Date
    May 2000
    Location
    Canada
    Posts
    533
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I dont see how .htaccess would interfere with PHP .. except authentication information, do you have anything else in your .htaccess ?

    ----------------------
    myPHPhost.com: need a PHP webhost?

  4. #4
    SitePoint Member djrob's Avatar
    Join Date
    Sep 2000
    Location
    Melbourne
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    .htaccess looks like this....


    order allow,deny
    allow from all
    require valid-user
    AuthType Basic
    AuthName "ASA Management"
    AuthPAM_Enabled off
    AuthUserFile /home/sites/site46/web/management/.htpasswd

    The 'generate' script does not seem to be able to find the parent .php3 file, even though they are in the same directory. The .html files reside in the public directory - 'web' in the above path, one step up.
    When I remove the .htaccess file, it works just fine, without changing any paths.


  5. #5
    SitePoint Wizard edshuck's Avatar
    Join Date
    Jul 2000
    Posts
    1,200
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hi

    just a quick question. when the generate script is clicked, is the required password and userid sent.

    did you set up both htaccess and htpassword? there is at least one spot that the files are very picky about. you do need both. i do not think there is any situation that will allow only the.htaccess to work alone. are there other files in the .htaccess dir and do they work correctly?

    also i just went back to my isp for information and this is the tutorial they recommend.

    http://hoohoo.ncsa.uiuc.edu/docs/tutorials/user.html

    [Edited by edshuck on 10-29-2000 at 05:05 AM]

  6. #6
    SitePoint Member djrob's Avatar
    Join Date
    Sep 2000
    Location
    Melbourne
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    just a quick question. when the generate script is clicked, is the required password and userid sent.
    (How do I parse it)

    did you set up both htaccess and htpassword? (yes)
    there is at least one spot that the files are very picky about. you do need both. i do not think there is any situation that will allow only the.htaccess to work alone. (both exist)
    are there other files in the .htaccess dir and do they work correctly? (yes they do)

  7. #7
    SitePoint Wizard edshuck's Avatar
    Join Date
    Jul 2000
    Posts
    1,200
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hi

    you will need to take a look at the tutorial i mention. your answer should be in there.

    for my use i log into the dir and then perform all my operations from there. and yes it is thru the browser but i have already logged in.

    I used the following to set up my .htaccess and password.

    The file .htaccess.
    This file should be in the directory which contains the documents to restrict access to. The contents of this file specify the name of the password file.

    For example if you were user jdoe with web documents in the local directory "/home/jdoe/public_html/goodstuff" that you wanted to restrict access to, your .htaccess might look like:

    AuthUserFile /home/jdoe/public_html/goodstuff/.htpasswd
    AuthName jdoe_goodstuff
    AuthType Basic
    <Limit GET>
    require valid-user
    </Limit>


    Note that .htaccess will not work if there are extra spaces after AuthUserFile.


    The file .htpasswd.
    This file contains the passwords of the users.

    To create the .htpasswd file log in to this server using telnet, change directory to the directory you want to restrict access to, and type:

    htpasswd -c .htpasswd someuser

    for the first user (where someuser is the username). You will then be prompted twice for the user's password. The -c option causes the .htpasswd file to be created. For each additional user type:

    htpasswd .htpasswd someuser



  8. #8
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    edshuck Just a quick note about a comment you made earlier
    quote: "did you set up both htaccess and htpassword? there is at least one spot that the files are very picky about. you do need both. i do not think there is any situation that will allow only the.htaccess to work alone. are there other files in the .htaccess dir and do they work correctly?"

    You can use .htaccess by itself for other things besides password-protection, as long as the administartor as Allowoveride directive set to all in the apache config file. You can set apache directives for a or php directives for a dir with .htacess. Say you was to have an auto-prepend file for every file in you dir but you don't want to set that value in your php.ini file because it would include it on every page in the whole site you could simply put a .htaccess file in you dir and put the following line in it:
    php_value auto_prepend_file "/pathtoprependfile/prepend.php"

    Or an apache directive to for instance to make apache parse a .htm or .html file as php only for a particular dir:
    AddType application/x-httpd-php .htm .html
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  9. #9
    SitePoint Wizard edshuck's Avatar
    Join Date
    Jul 2000
    Posts
    1,200
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hi freddydoesphp

    you may have given djrob the answer he was seeking.

    GREAT.

    and thanks for the information. when i did my install/began to use the .htaccess i followed the guide and everything worked so i did not read further and since i had no need for .htaccess less .htpasswd i just went merrily along.

    the "picky part" is that little "space" mentioned in my previous post.
    Note that .htaccess will not work if there are extra spaces after AuthUserFile


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •