While uploading a file of larger size in CWP using the file manager, you may encounter a file upload error as following in the log file /usr/local/cwpsrv/logs/error_log.
[otw_shortcode_info_box border_type=āborderedā border_color_class=āotw-blue-borderā border_style=āborderedā]2021/05/24 04:20:58 [error] 2578322#0: *114 client intended to send too large body: 720059757 bytes, client: 117.203.36.77, server: localhost, request: āPOST /cwp_7c0f4a5796597df4/testfil/testfil/index.php?module=filemanager&acc=uploadFiles HTTP/1.1ā, host: āhost.example.com:2083ā, referrer: āhttps://host.example.com:2083/cwp_7c0f4a5796597df4/testfil/fileManager_v2.phpā[/otw_shortcode_info_box]
The file shows as upload complete as in the below screenshot, but the file is not uploaded in the location.
In the latest CWP versions like 0.9.8.1064, you get an error as following in the screenshot (you can see the file upload maximum limit already displayed).
The CWP (Centos Web Panel) uses a different php.ini file to load the PHP configurations for the control panel interfaces. The /usr/local/cwp/php71/php.ini is the default PHP server configuration file of cwpsrv service for CWP admin panel, CWP user panel, phpMyAdmin, and Roundcube.
(The php. ini file is the default configuration file for running applications that require PHP).
To solve this, you need to edit the CWP PHP configuration:
Step 1: On the command line, first backup the php.ini file.
[otw_shortcode_info_box border_type=āborderedā border_color_class=āotw-blue-borderā border_style=āborderedā]cp /usr/local/cwp/php71/php.ini /usr/local/cwp/php71/php.ini.bak[/otw_shortcode_info_box]
Step 2: Edit the configuration file.
[otw_shortcode_info_box border_type=āborderedā border_color_class=āotw-blue-borderā border_style=āborderedā]vi /usr/local/cwp/php71/php.ini[/otw_shortcode_info_box]
Step 3: To upload a bigger file via File manager, you need to adjust the following PHP configuration directives.
Locate the following and change to your size and in this case, I am using 100MB for upload_max_filesize.
upload_max_filesize: By default this value is 64MM. You need to increase it to the maximum size of a single file that we want to upload.
post_max_size: It defines the maximum size of POST data that PHP will accept. This value should be greater than āupload_max_filesizeā.
memory_limit: This sets the amount of memory a PHP script is allowed to use during its execution. Set this to a value greater than āpost_max_sizeā so that the PHP script can load and process the uploaded file.
max_input_time: This sets the maximum time in seconds a script is allowed to parse input data, like POST and GET. Timing begins at the moment PHP is invoked at the server and ends when execution begins. This would include populating $_FILES superglobal.
max_execution_time: The time a script is allowed to run after its input has been parsed. This would include any processing of the file itself.
[otw_shortcode_info_box border_type=āborderedā border_color_class=āotw-blue-borderā border_style=āborderedā]upload_max_filesize = 100M post_max_size = 150M memory_limit = 150M max_input_time = 90 max_execution_time = 90[/otw_shortcode_info_box]