PHP and .htaccess <IfModule mod_php5.c / mod_php7.c> </IfModule> Values - Clarification Request

The Elgg .htaccess <IfModule mod_php5.c or mod_php7.c> </IfModule> Values comes in binary by default for post_max_size & upload_max_filesize as shown bellow:

# limit the maximum memory consumed by the php script to 64 MB
    php_value memory_limit 64M
    # post_max_size is the maximum size of ALL the data that is POST'ed to php at a time (8 MB)
    php_value post_max_size 8388608
    # upload_max_filesize is the maximum size of a single uploaded file (5 MB)
    php_value upload_max_filesize 5242880
    # on development servers, set to 1 to display errors. Set to 0 on production servers.
    php_value display_errors 0

I am using Php 7.1 for Elgg 2.3.10, Version - 2016092300.

Let's say that in Php 7.1, I have set the following values for given parameters:

  • memory limit set as 128M
  • post size set as 64M
  • upload size as 32M

Now, that I have to sync the .htaccess, I come have across  the following conversations:

Post Size  64 MB = 64000000 Bytes (in decimal) or
Post Size 64 MB = 67108864 Bytes (in binary)

As mentioned above, elgg .htaccess comes in binary by default.

In stead of choosing decimal or binary, I simply synced <IfModule mod_php5.c  AND  mod_php7.c> </IfModule> as

memory limit set as 128M
post size set as 64M
Mupload size as 32M

The above values rightfully register in Elgg Server Info as following

PHP version : 7.1.25
PHP ini file location : /home/sys/php7.1/php.ini
PHP Log : Web server's error log
Memory available : 134,217,728
Memory used : 18,609,096
POST maximum size : 67,108,864
Upload maximum size : 33,554,432 


Q1. I would like to know if there is a performance factor involved in how the .htaccess vales are declared?
Q2. Did Elgg .htaccess  mod_php5.c AND  mod_php7.c  values came as binary for a specific reason?

I would appreciate a clarification. Thank You. - shaD at MyHoTFB

                                                    
 

  • It's not binary/decimal. The M is just the unit to be used in .htaccess or php.ini if you want to set a size in Megabyte. Without unit the number is taken as bytes. I don't think there's any difference in performance. It's just easier to define the size for example as 128M instead of 134217728. I also don't think there's any specific reason the sizes are still defined in bytes in Elgg's .htaccess. Maybe PHP couldn't handle units (like M) in the past but nowadays it wouldn't matter anymore.

  • @ilony

    Thanks for the information and clarification. Appreciated.