php.ini is an important file which declares default settings for running applications that require PHP. It is used to control variables such as upload sizes, file timeouts, and resource limits.
Table of Contents
Change maximum upload file size
By default, the maximum upload file size for PHP scripts is set to 2 MB and the maximum file size allowed posted via a form is 8MB.
upload_max_filesize = 10M post_max_size = 11M
Remember to use bigger value for post_max_size compared to upload_max_filesize to ensure uploading to work properly.
Increase Memory Limit
When working with PHP, developers often encounter this error message “Fatal error: Allowed memory size of x bytes exhausted (tried to allocate x bytes) in /path/to/php/script”.
It happens because the system runs out of allocated memory to PHP when executing a script. Increasing memory limit to a bigger number to address this issue.
memory_limit = 256M
Enable Sockets Extension
Socket extension is not enabled by default even thought it is packed with PHP when installed. You can check to see if it was missing by finding for php_sockets.dll
in php\ext
folder.
Un-comment or add the following line to enable the extension:
extension=php_sockets.dll