Apache / Nginx / Lighttpd: PHP Disable File Upload

Apache / Nginx / Lighttpd: PHP Disable File Upload

To disable file uploads in PHP, you will need to modify the file_uploads setting in your PHP configuration.

In Apache, you can modify the file_uploads setting by adding the following line to a .htaccess file or to the Apache configuration file (usually httpd.conf):

php_flag file_uploads off
‮oS‬urce:www.lautturi.com

In Nginx, you can modify the file_uploads setting by adding the following line to the Nginx configuration file (usually nginx.conf):

fastcgi_param PHP_VALUE "file_uploads=off";

In Lighttpd, you can modify the file_uploads setting by adding the following line to the Lighttpd configuration file (usually lighttpd.conf):

setenv.add-environment = ("PHP_VALUE" => "file_uploads=off")

After modifying the configuration, you will need to restart the web server to apply the changes.

It's important to note that disabling file uploads in PHP will prevent users from uploading files through your website. This may be necessary for security reasons or to prevent abuse of the file upload feature.

Created Time:2017-10-27 14:56:33  Author:lautturi