1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

PHP disable on file wise

Discussion in 'PHP' started by asela_05085, Sep 22, 2009.

  1. #1
    hi all,

    with your help i was able to disable PHP on my web server on folder wise (i.e disable PHP for specific folder)
    now my company has given me a new challenge to disable PHP on file wise.
    i.e : I want only to execute some PHP files with specific names and not to execute any other PHP files with different names (e.g : only to run index.php and any other PHP file will not run/no matter where is the location of the file)

    pls somebody advice me on this
     
    asela_05085, Sep 22, 2009 IP
  2. TecBrat

    TecBrat Member

    Messages:
    31
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    48
    #2
    I am doing something like this on one of my sites.

    Try adding something like this to your .htaccess file. (Assuming you are usign Apache)
    <FilesMatch "\.php$"> 
    order deny,allow 
    deny from all 
    </FilesMatch> 
    
    <Files index.php>
    order allow,deny
    allow from all
    </Files>
    Code (markup):
    If your server is not using Apache, then do a search in Google for the .htaccess equivilent for your server app.
     
    TecBrat, Sep 22, 2009 IP
  3. asela_05085

    asela_05085 Peon

    Messages:
    24
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    thanks for the reply
    I'm using Apache and how do i no whether htaccess is working on my server?
    is there a way to check that?
     
    asela_05085, Sep 22, 2009 IP
  4. asela_05085

    asela_05085 Peon

    Messages:
    24
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    instead of .htaccess can i put below lines in my httpd.conf file?

    <FilesMatch "\.php$">
    order deny,allow
    deny from all
    </FilesMatch>

    <Files index.php>
    order allow,deny
    allow from all
    </Files>
     
    asela_05085, Sep 22, 2009 IP
  5. TheOnly92

    TheOnly92 Peon

    Messages:
    17
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #5
    You can under the subdomain configuration, but it's still best you put in .htaccess.

    To put .htaccess, just create a file .htaccess at the folder you want to disable php access, then copy the lines into the file.
     
    TheOnly92, Sep 23, 2009 IP