Shell Script To Turn On or Off PHP Uploads For Php5-fpm/Apache/Nginx/Lighttpd Web Servers

in Categories Security, Web Server last updated September 5, 2016

A simple shell script wrapper to disable or enable PHP 5 upload support in an Apache or Nginx or Lighttpd web server. The script look for file_uploads directive in php.ini file and change its state from ON to OFF or vice-versa.

When you allow files to be uploaded to your system you assume a number of risks, files may not be what the appear (executables masquerading as images, php scripts uploaded and moved to a location where they may be run, et-cetera). If your site doesn’t actually require file uploads, disabling this will prevent files from being accepted inadvertently. We recommend that you always keep this to off. See our php security guide for sysadmin more information.

Share this on:

1 comment

  1. I could be wrong, but doesn’t Bash support case-insensitive letter matching without having to use something like §[uU]§, in the main logic ?

    Have a question? Post it on our forum!