How do I control and put limits on php scripts such as maximum execution time of each script and upload file size?
PHP supports the following resource limits directives in php.ini file:
- max_execution_time : Maximum execution time of each script, in seconds.
- max_input_time : Maximum amount of time each script may spend parsing request data.
- memory_limit : Maximum amount of memory a script may consume.
Edit php.ini, enter:
# vi /etc/php.ini
Set up values as follows:
max_execution_time = 30 max_input_time = 30 memory_limit = 40M
Set maximum size of POST data that PHP will accept:
post_max_size = 8M
Set maximum allowed size for uploaded files:
upload_max_filesize = 2M
Turn on or off HTTP file uploads (disallow uploading unless necessary):
file_uploads = Off
Make sure PHP redirects appropriately with the following:
cgi.force_redirect = 0
Disable file requests as fopen calls with the following
allow_url_fopen = Off
Turn on SQL safe mode:
sql.safe_mode = OTweet itFacebook itG+ itDownload PDF versionFound an error/typo on this page?
- 30 Cool Open Source Software I Discovered in 2013
- 30 Handy Bash Shell Aliases For Linux / Unix / Mac OS X
- Top 30 Nmap Command Examples For Sys/Network Admins
- 25 PHP Security Best Practices For Sys Admins
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- Linux: 20 Iptables Examples For New SysAdmins
- Top 20 OpenSSH Server Best Security Practices
- Top 20 Nginx WebServer Best Security Practices
- 20 Examples: Make Sure Unix / Linux Configuration Files Are Free From Syntax Errors
- 15 Greatest Open Source Terminal Applications Of 2012
- My 10 UNIX Command Line Mistakes
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- The Novice Guide To Buying A Linux Laptop