Apache / Nginx / Lighttpd: PHP Disable File Upload

To disable file uploads in PHP for Apache, Nginx, or Lighttpd web servers, you need to modify the PHP configuration file php.ini.

Here’s how to disable file uploads in PHP:

  1. Open the php.ini file:
sudo nano /etc/php/7.4/fpm/php.ini
  1. Find the following line:
file_uploads = On
  1. Change On to Off:
file_uploads = Off
  1. Save the changes and exit the editor.
  2. Restart the web server to apply the changes:
sudo systemctl restart nginx

Note: The location of the php.ini file and the command to restart the web server may vary depending on your specific web server and distribution.

After making these changes, PHP file uploads will be disabled on your server.

Leave a Comment