user991329
user991329

Reputation: 63

Disable php functions via .htaccess

I want to disable few php functions only in a specific folder, I thought of using htaccess:

For example I have tried adding this line:

php_admin_value disable_functions "system, etc.."

However it doesn't work, I just get 500 error, if you know how to make it work, please share.

Appreciate any help on this subject.

-- EDIT --

I have turned on my litespeed and now there are no more errors, but system() is still allowed, I want to turn it off for my server's home folder.

Any solutions ?

Upvotes: 2

Views: 11144

Answers (4)

wlf
wlf

Reputation: 861

http://www.php.net/manual/en/ini.core.php#ini.disable-functions

This directive allows you to disable certain functions for security reasons. It takes on a comma-delimited list of function names. disable_functions is not affected by Safe Mode.

Only internal functions can be disabled using this directive. User-defined functions are unaffected.

This directive must be set in php.ini For example, you cannot set this in httpd.conf.

Upvotes: 3

echo_Me
echo_Me

Reputation: 37253

in your .htaccess put

php_admin_value disable_functions " "

This is only if you are allow to do so. Give it a shot.

Upvotes: 0

user149341
user149341

Reputation:

php_admin_value is not valid in .htaccess files. It can only be used in httpd.conf. See: http://php.net/configuration.changes for details.

Use php_value instead, or add the directive in a <Location> or <Directory> block in httpd.conf.

Upvotes: 3

KodeFor.Me
KodeFor.Me

Reputation: 13511

Propably the HTTP Status code 500 comes from wrong .htaccess file.

You can rename the .htaccess file to something else for a while to check if the problem comes from there. If so you can then paste the .htaccess code here to give you the solutions.

Upvotes: 0

Related Questions