Ticket #216 (closed defect: fixed)

Opened 11 years ago

Last modified 11 years ago

PHP not allowing Speech Submissions larger than 2M to be uploaded

Reported by: kmaclean Owned by: kmaclean
Priority: minor Milestone: SpeechSubmission 0.1
Component: SpeechSubmission Version: Website 0.2
Keywords: Cc:

Description (last modified by kmaclean) (diff)

PHP not allowing files larger than 2M to be uploaded. Relevant settings:

From the manual:

upload_max_filesize integer

The maximum size of an uploaded file.

When an integer is used, the value is measured in bytes. You may also use shorthand notation as described in this FAQ.

Changes to php.ini:

; Maximum allowed size for uploaded files.

; !!!!!!
;upload_max_filesize = 2M
upload_max_filesize = 50M
;!!!!!!

From the manual:

post_max_size integer

Sets max size of post data allowed. This setting also affects file upload. To upload large files, this value must be larger than upload_max_filesize.

If memory limit is enabled by your configure script, memory_limit also affects file uploading. Generally speaking, memory_limit should be larger than post_max_size.

When an integer is used, the value is measured in bytes. You may also use shorthand notation as described in this FAQ.

If the size of post data is greater than post_max_size, the $_POST and $_FILES superglobals are empty. This can be tracked in various ways, e.g. by passing the $_GET variable to the script processing the data, i.e. <form action="edit.php?processed=1">, and then checking if $_GETprocessed? is set.

Changes to php.ini:

; Maximum size of POST data that PHP will accept.
; !!!!!!
;post_max_size = 8M
post_max_size = 50M
; !!!!!!

Changes to php.ini:

; !!!!!!
;memory_limit = 16M      ; Maximum amount of memory a script may consume
memory_limit = 50M      ; Maximum amount of memory a script may consume
; !!!!!!

Change History

comment:1 Changed 11 years ago by kmaclean

  • Description modified (diff)

Other relevant settings:

;;;;;;;;;;;;;;;;;;; ; Resource Limits ; ;;;;;;;;;;;;;;;;;;;

max_execution_time = 30 ; Maximum execution time of each script, in seconds max_input_time = 60 ; Maximum amount of time each script may spend parsing request data

comment:2 Changed 11 years ago by kmaclean

;;;;;;;;;;;;;;;;;;;
; Resource Limits ;
;;;;;;;;;;;;;;;;;;;

max_execution_time = 30     ; Maximum execution time of each script, in seconds
max_input_time = 60	; Maximum amount of time each script may spend parsing request data

comment:3 Changed 11 years ago by kmaclean

Need to find out what the max is on VoxForge? Repository!

comment:4 Changed 11 years ago by anonymous

  • Priority changed from major to minor

comment:5 Changed 11 years ago by kmaclean

YOu can override hoster's php.ini - see Using a php.ini File:

How a php.ini File is Read

When the PHP interpreter starts up, it behaves according to settings specified in any availabe php.ini file. The Web server will look for this file in the following locations and in the following order:

  1. The directory from which the PHP script was called
  2. The root of your Web directory (typically public_html)
  3. The Web server's default php.ini

The Web server's PHP configuration file will always be used if you don't have your own

comment:6 Changed 11 years ago by kmaclean

A php.ini file that you write must overwrite every setting in the UW's global php.ini file to achieve full functionality (see note below). Thus you must obtain a copy of the entire recommended php.ini template(see the previous paragraph), rename it to php.ini, and then adjust the settings of the file to the values you desire.

Note: you cannot use your configuration file to extend the Web server's PHP settings. Only settings in your own php.ini will be used if you have one. If you set only a few settings, all other settings will use the hard-coded values in the PHP interpreter.

comment:7 Changed 11 years ago by kmaclean

  • Status changed from new to closed
  • Resolution set to fixed

Fixed on repository - put update php.ini file in same directory as NewSubmitSpeechServer?.php file.

comment:8 Changed 11 years ago by root

  • Milestone SpeechSubmission 0.1 deleted

Milestone SpeechSubmission 0.1 deleted

comment:9 Changed 11 years ago by kmaclean

  • Milestone set to SpeechSubmission 0.1
Note: See TracTickets for help on using tickets.