Results 1 to 9 of 9

Thread: PHP class files.

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Oct 1999
    Location
    England
    Posts
    982

    PHP class files.

    I have a few PHP class files that I do not want users to access.
    Where is the best place to put them?


    Things I do when I am bored: DotNetable

  2. #2
    PowerPoster
    Join Date
    Sep 2003
    Location
    Edmonton, AB, Canada
    Posts
    2,629
    put them into an empty folder and then upload a .htaccess file with a deny from all statement.

    if you don't know how to make one, just open notepad, save a file as ".htaccess" and then add this to it:

    Code:
    order deny,allow
    deny from all
    Like Archer? Check out some Sterling Archer quotes.

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Oct 1999
    Location
    England
    Posts
    982
    Looks good to me.

    Thanks.


    Things I do when I am bored: DotNetable

  4. #4
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906
    The most secure place to put them is above the document root and chmod the file to 0660.

    N.B. This may not work if PHP is an apache module.
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Oct 1999
    Location
    England
    Posts
    982
    I actually put the following lines in the httpd.conf file which worked a treat.

    <Directory "C:/Program Files/Apache Group/Apache2/htdocs/classes">
    AllowOverride None
    Options None
    Order allow,deny
    deny from all
    </Directory>


    I take it this only worked because the server is installed on my local machine. If I was paying someone to host my site I wouldn't have that level of access so I would have to use the htaccess files.


    Things I do when I am bored: DotNetable

  6. #6

    Thread Starter
    Fanatic Member
    Join Date
    Oct 1999
    Location
    England
    Posts
    982
    VisualAd: What do you mean by chmod. I have seen this mentioned but thought it only related to Linux. How does it relate to Windows?


    Things I do when I am bored: DotNetable

  7. #7
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906
    Originally posted by davidrobin
    VisualAd: What do you mean by chmod. I have seen this mentioned but thought it only related to Linux. How does it relate to Windows?
    chmod is Linux only. I assumed that was what you were using. It allows you to change file permissions.

    On linux apache runs as an un priviledged user and you can configure PHP to run as a different user enabling you to give PHP different access rights for files.

    The equivelent on windows is editing the security descriptor on a file. However on Windows this probably won't work as apache runs as a service. I believe that when a program runs as a service it has access to the whole system. I'm not sure though.

    If you are using Windows I would definatly put the script files above the document root though. e.g:

    C:/Program Files/Apache Group/Apache2/classes
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  8. #8

    Thread Starter
    Fanatic Member
    Join Date
    Oct 1999
    Location
    England
    Posts
    982
    Thanks VisualAd.

    I have been thinking of installing Linux on an old machine I have at home. It seems a lot of work compared to widows. More maintenance that is, everything takes twice as long to install or configure. Thats as much as I can say about it though.
    I tried installing SUSE 6 once but a few of my hardware components were not compatible so I had to abandon it. I believe recent version are a lot better.

    Also it takes so long to download, time and bandwidth are something I don't have at the moment.

    I will have to give it a bit more thought.


    Things I do when I am bored: DotNetable

  9. #9
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906
    Once it's up and running Linux requires a lot less attention than Windows.

    I have a Linux Server and it just sits there minding its own business - doing what it's supposed to do. The easiest way to get Linux without having to download it is to buy a Linux Magazine. They often come with full distributions. A couple of months back Linux Format came with Mandrake 9.2. Not only that if you buy the magazine you also get a bit of support installing it..

    My advice would be to get an old system together and install Linux as a server and play around. The hardware that usually causes the problems is modems and graphics cards. If you are not interested in graphics though you can just choose to have a simple text console. In my opinion an MS-DOS like CLI is a lot more friendly that having to navigate through hierarchies of menus and complex GUI's.
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

Posting Permissions

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



Click Here to Expand Forum to Full Width