Configuring and Optimizing PHP 5

  • Allowing uploads larger than 2MB

    Our next step is to configure PHP 5 to work a little bit better with Jamroom. "Out of the box" PHP is only configured for a 2mb (2 megabyte) max upload value - on other words the largest file you can upload is only going to be 2mb.

    So our first order of business is to adjust this value to allow a larger uploads - in this case we're going to set our values to "256M" (without the quotes) - this will equate to a max upload value in Jamroom of 64 megabytes.
  • Both the Jamroom Audio and Video module feature media conversions - i.e. they will take an uploaded file in many different formats and convert it to MP3 (for audio) or FLV/MP4 (for video). Media conversions however, are very CPU and RAM intensive - this is why Jamroom's max upload size is 1/4th of the value you set in the php.ini file - this leaves the necessary "overhead" in RAM that Jamroom needs to do the conversions.

    So if you need a larger upload (say 256 megabytes), use "1024M" (without the quotes) as the value in your php.ini.
  • So the main php.ini file will be found at:

    /etc/php5/apache2/php.ini

    We're going to edit that file now:

    pico /etc/php5/apache2/php.ini
    

    Scroll down in that file until, one at a time, you find and change the following settings:

    ; Maximum amount of memory a script may consume (128MB)
    ; http://php.net/memory-limit
    memory_limit = 256M
    

    ; Maximum size of POST data that PHP will accept.
    ; http://php.net/post-max-size
    post_max_size = 256M
    

    ; Maximum allowed size for uploaded files.
    ; http://php.net/upload-max-filesize
    upload_max_filesize = 256M
    

    Set all 3 of those settings to 256M and save the file.

Tags