Search code examples
laravelswoolelaravel-octaneopenswoole

How to increase max file upload size for Laravel Octane?


I can't upload file larger than 2MB while running Laravel 11 on Octane.

Without Octane it works so it does not seem to be problem with Nginx or PHP. I tried Frankenphp and Swoole and both failed to upload file. How can I increase this limit? From where is it configured?


Solution

  • By default, Swoole package size limit is 2MB. You can customize this from Laravel by changing the config package_max_length under swoole -> options in your octane.php

    // config/octane.php
    
    'swoole' => [
        'options' => [
            'log_file' => storage_path('logs/swoole_http.log'),
            'package_max_length' => 10 * 1024 * 1024, // 10 MB
        ],
    ],
    

    Reference: https://laravel.com/docs/11.x/octane#swoole-configuration

    enter image description here

    In case you need to customize Swoole more, here is a link with the full list of options : https://openswoole.com/docs/modules/swoole-server/configuration#list-of-configurations