简体   繁体   中英

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 ?

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.

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 .

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.

in your .htaccess put

php_admin_value disable_functions " "

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM