2

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 ?

3
  • 1
    Check your server's error log. Details about the 500 will be listed there. most likely you've got a syntax error in the .htaccess file, which can also involve things like using a directive which the server config does not allow. Commented Oct 18, 2011 at 17:07
  • I think it's about your syntax, check error log as Marc B said Commented Oct 18, 2011 at 17:11
  • I got this error: "..../public_html/.htaccess: Invalid command 'php_admin_value', perhaps misspelled or defined by a module not included in the server configuration" - I have also tried "php_value" but the same error occurs, do you know the correct command for this ? Commented Oct 18, 2011 at 17:31

4 Answers 4

3

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.

Sign up to request clarification or add additional context in comments.

3 Comments

so should I use "php_value system off" etc each command separately, would this work ?
php_value disable_functions "system" or something of the sort.
Well, it simply can't be done in .htaccess. The other suggestions are fine.
3

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.

Comments

0

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.

Comments

0

in your .htaccess put

php_admin_value disable_functions " "

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

1 Comment

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.