Jump to content

Recommended Posts

Posted

Greetings all from downunder (but don't hold that against me :oops: )

 

Not sure if this is possible or not, but can PHP be disabled for a particular sub domain? I was considering offering a friend an ftp account and some space to store pictures on my account, however for my own protection I would prefer not having to worry about any scripts be uploaded without my knowledge.

 

Is it possible to disable PHP on a particular sub domain or directory? I don't want to install any custom upload software, if it's not something that can be done via .htaccess or similar I'll just say no to the friend.

 

Thanks for any help.

 

Cheers :shocking:

Posted

Hi Qinau.

 

I don't think that's possible. PHP/Perl/Python are enable for your whole account and can't be disabled/enabled per sub-domain. Someone will correct me if I'm wrong but at least I have never seen anything that would allow me to do that.

Posted

Good thinking, Andy.

 

I was only thinking of a way to disable scripts via cPanel, I didn't even think of the possibility of using other methods :oops:

 

Thanks for pointing those out :shocking:

Posted

Thanks guys :shocking:

 

Some testing reveals that I don't think I'll be able to achieve what I want.

 

Disabling PHP from htaccess works however as that file is in the directory I'm giving access to it's a little pointless. I tried specifying it in my root htaccess without luck. I'd also forgotten about Perl & Python which I'd also need to cater for [or against]

 

Not sure if you could point me in the right direction Andy re: the disabling particular extensions? That would appear ideal if it can be achieved from outside the subdirectory.

 

Cheers :)

Posted (edited)

Use the Directory directive to set options for a subfolder in your root .htaccess file:

http://httpd.apache.org/docs/mod/core.html#directory

 

Also, to disable scripting, set the MIME type for .php, .pl, .py (and so on) files to text/plain, using the AddType directive:

http://httpd.apache.org/docs/mod/mod_mime.html#addtype

 

Haven't tested them here on TCH servers, but in general, these should do the trick.

 

Let us know how it goes.

 

EDIT:

Directory doesn't work for me for some reason, however Location works, use it instead:

http://httpd.apache.org/docs/mod/core.html#location

 

Is directory disabled on HTC servers? Or am I doing something wrong?

Edited by Ayman
Posted (edited)

Hmm, I've tried to edit my previous post but I couldn't...

 

Here is what to add to your .htaccess in public_html:

><Location /subdomaindir>
 AddType text/plain .php
 AddType text/plain .php3
 AddType text/plain .pl
 # add more extensions here
</Location>

 

I think this should do the trick, please let us know how it goes.

 

EDIT:

Should have posted once I've tried everything, instead of posting/editing all the time, anyway, Location doesn't work for me either, is it me? Or are these directives disabled here?

Edited by Ayman
Posted

You can't use Directory or Location directives in an .htaccess file - Apache does not allow it. The help desk could put such a directive in the server's configuration file, but I'm not sure if they'd be willing to do that (my instinct says they would not).

Posted

Thanks for going to the trouble of posting links and testing Ayman :) I had tried the <directory> myself earlier without success, oh well.

 

I wont ask the helpdesk David, it's not that important and I suspect as you do it's probably not something they'd do anyway.

 

Thanks to both of you for your input.

 

Cheers

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...