Blocking PHP access

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
asela_05085
Forum Newbie
Posts: 16
Joined: Mon Aug 31, 2009 10:33 pm

Blocking PHP access

Post by asela_05085 »

hi,

can i disable PHP in folder wise(i.e : in folders, where i need to disable PHP functionality)

thanks :( :(
User avatar
Mirge
Forum Contributor
Posts: 298
Joined: Thu Sep 03, 2009 11:39 pm

Re: Blocking PHP access

Post by Mirge »

Haven't tried it, but worth a shot: http://www.faqts.com/knowledge_base/vie ... 128/fid/35
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Re: Blocking PHP access

Post by John Cartwright »

I'm pretty sure if you remove execute permission on the folder using chmod -- like 666 -- it will prevent any scripts from executing.

Test first though.
asela_05085
Forum Newbie
Posts: 16
Joined: Mon Aug 31, 2009 10:33 pm

Re: Blocking PHP access

Post by asela_05085 »

hi,

the chmod 666 option seems forbidden exciting .html files as well but i need to run .html files in those folders.

the http.conf option seems disable PHP globally. i.e not only in the intended folder

any idea pls :(
User avatar
dude81
Forum Regular
Posts: 509
Joined: Mon Aug 29, 2005 6:26 am
Location: Pearls City

Re: Blocking PHP access

Post by dude81 »

there should be a way using .htaccess to make php_engine off. Hope that helps
asela_05085
Forum Newbie
Posts: 16
Joined: Mon Aug 31, 2009 10:33 pm

Re: Blocking PHP access

Post by asela_05085 »

yes i have heard about that. someone told me to put below line in .htaccess file
AddType text/plain .php

but it didn't work for me.
I'm not sure whether i have to make any further modifications (like restarting the server etc..)

pls advice
User avatar
dude81
Forum Regular
Posts: 509
Joined: Mon Aug 29, 2005 6:26 am
Location: Pearls City

Re: Blocking PHP access

Post by dude81 »

No that is not correct I believe, simply adding following line in .htaccess should be enough and restart the apache

php_engine off or
php_flag engine off

one of the above should work
asela_05085
Forum Newbie
Posts: 16
Joined: Mon Aug 31, 2009 10:33 pm

Re: Blocking PHP access

Post by asela_05085 »

no luck with that. I'm wondering why it didn't work :(
dude81, have you tried that previously?
User avatar
dude81
Forum Regular
Posts: 509
Joined: Mon Aug 29, 2005 6:26 am
Location: Pearls City

Re: Blocking PHP access

Post by dude81 »

None of them worked?

Code: Select all

 
php_engine off 
 
or

Code: Select all

 
php_flag engine off
 
and restarted apache. I remember using them some long time back
[*] The last one was working for me..., I just checked
Post Reply