Blog

  • PHP.ini settings to upload a large image

    I have a PHP web app running on a shared Ubuntu server that uploads images to Amazon S3 storage. On a mobile phone the camera can be used to upload a photo directly.

    All worked fine until someone upgraded the version of PHP and the uploads stop working.

    It turns out that this had reset the PHP file upload settings to their defaults, giving a max upload size of 2Mb which was too small for photos taken on the mobile phone.

    The fix, with some help from ChatGTP , was to update the following php.ini file settings

    ; Maximum allowed size for uploaded files.
    ; http://php.net/upload-max-filesize
    upload_max_filesize = 256M
    
    ; Maximum size of POST data (must be equal or larger than upload_max_filesize)
    ; http://php.net/post-max-size
    post_max_size = 280M
    
    ; Max execution time for scripts (seconds)
    ; http://php.net/max-execution-time
    max_execution_time = 90
    
    ; Optional: Max input time for parsing data (seconds)
    max_input_time = 60
    

    and also update the Apache config (i.e. /etc/apache2/sites-available/000-default.conf), setting LimitRequestBody in the <Directory> block to an appropriate size for the bytes allowed in the request body.

            <Directory /var/www/xxx>
                ...
                LimitRequestBody 268435456
            </Directory>

    An apache restart got the uploads working again

    sudo systemctl restart apache2

    Being on a shared server I also updated the .htaccess file just in case there was a later need for the server settings to be changed.

    php_value upload_max_filesize 256M
    php_value post_max_size 272M
    php_value max_execution_time 90
    php_value max_input_time 90
    php_value memory_limit 384M

    The settings in the .htaccess file override the php.ini settings when using Apache + mod_php.

  • Code in transit

    Sometimes my most productive coding is done on the move, over a coffee at a cafe, waiting in a hotel lobby or at an airport

  • Work in Progress – June 2025

    64Houses.io is currently a “Work in Progress”.

    Over time the following online services will be added

    • CAS Designer – Construction Assurance Service online service for designing and managing building industry checklists that are used on-site to validate construction work as it is complete.
    • CAS Checker – Construction Assurance Service onsite Checking. This is a mobile phone online service that complements the CAS Designer, making it easy to validate completed construction work on site.
    • CAS Designer – Healthy Homes New Zealand – a version of CAS Designer tailored to supporting the New Zealand Healthy Homes building standards.
    • CAS Checker Healthy Homes New Zealand – a version of CAS Checker tailored to supporting the New Zealand Healthy Homes building standards on-site, with extensions to Homes Inspection before and during House Rentals.
    • CAS APIs – Providing API access to Construction Assurance Services, especially useful for other organisations wanting to integrate these services into the with their own applications.

    And the occasionally fun posts like

  • How cats choose a Domain Name

    Thinking …

    Thinking …

    Done …

  • Hello world!

    Welcome to WordPress. This is your first post. Edit or delete it, then start writing!