how to increase file upload limit in one click install cyberpanel 2.0 by digital ocean

i tried the guide in cyberpanel for increasing the file upload by host conf but the file itself does not contain any file upload limit parameter or words in it but still, I had added them but I got message like the server is not reachable! is there any way to increase file upload limit

im not good in coding can you please guide me on increasing file upload limit in cybpanel 2.0

easy as pie for all versions. one of the first things i do to PHP after installation

this raises the memory_limit to 1024M
raises the post_max_size to 128M
raises the upload_max_filesize 128M

for phpver in $(ls -1 /usr/local/lsws/ |grep lsphp | sed ‘s/lsphp//g’) ; do echo “”; echo “LSPHP $phpver” ; sed -i -e ‘s/^memory_limit./memory_limit = 1024M/g’ -e 's/^post_max_size./post_max_size = 128M/g’ -e ‘s/^upload_max_filesize.*/upload_max_filesize = 128M/g’ /usr/local/lsws/lsphp$phpver/etc/php.ini; /usr/local/lsws/lsphp$phpver/bin/php -i |grep -Ei ‘memory_limit|post_max_size|upload_max_filesize|max_execution_time’ && echo “” ; done; service lsws restart && killall lsphp;

Then to check those limits you can use the below oneliner:

for version in $(ls /usr/local/lsws|grep lsphp); do echo “”; echo “PHP $version”; /usr/local/lsws/${version}/bin/php -i |grep -Ei ‘memory_limit|post_max_size|upload_max_filesize|max_execution_time’; done

Type your comment> @whattheserver said:

easy as pie for all versions. one of the first things i do to PHP after installation

Thanks for sharing this tip. I’d like to put it to use.

I tried running those commands on CyberPanel 1.9 build 3.

It ran into issues, due to paths being wrong. Is that because the folder structure has changed on CyberPanel 2.0 (I have no idea if it has), and your commands are for that version?

For example, the php.ini on my lsphp7.4 are in:
/usr/local/lsws/lsphp74/etc/php/7.4/litespeed/php.ini

You command (first one) gives the error:
sed: can't read /usr/local/lsws/lsphp74/etc/php.ini: No such file or directory

Any suggestions?

This is due to it being Ubuntu vs Centos.

Just made the Ubuntu variant which accounts for the slightly different path to the .ini files see below.

Centos:
/usr/local/lsws/lsphp74/etc/php.ini

/usr/local/lsws/lsphp$phpver/etc/php.ini

for phpver in $(ls -1 /usr/local/lsws/ |grep lsphp | sed ‘s/lsphp//g’) ; do echo “”; echo “LSPHP $phpver” ; sed -i -e ‘s/^memory_limit./memory_limit = 1024M/g’ -e 's/^post_max_size./post_max_size = 128M/g’ -e ‘s/^upload_max_filesize.*/upload_max_filesize = 128M/g’ /usr/local/lsws/lsphp$phpver/etc/php.ini; /usr/local/lsws/lsphp$phpver/bin/php -i |grep -Ei ‘memory_limit|post_max_size|upload_max_filesize|max_execution_time’ && echo “” ; done; service lsws restart && killall lsphp;

Ubuntu:
/usr/local/lsws/lsphp74/etc/php/7.4/litespeed/php.ini

/usr/local/lsws/lsphp$phpver/etc/php/$phppoint/litespeed/php.ini

sed ‘s/^\(.\{1\}\)/\1./’

echo ‘74’ | sed ‘s/^\(.\{1\}\)/\1./’

echo ‘74’ | sed ‘s/^\(.\{1\}\)/\1./’

7.4

$phppoint=$(echo $phpver | sed ‘s/^\(.\{1\}\)/\1./’)

for phpver in $(ls -1 /usr/local/lsws/ |grep lsphp | sed ‘s/lsphp//g’) ; do echo “”; echo “LSPHP $phpver” ; sed -i -e ‘s/^memory_limit./memory_limit = 1024M/g’ -e 's/^post_max_size./post_max_size = 128M/g’ -e ‘s/^upload_max_filesize.*/upload_max_filesize = 128M/g’ /usr/local/lsws/lsphp$phpver/etc/php/$(echo $phpver | sed ‘s/^\(.\{1\}\)/\1./’)/litespeed/php.ini; /usr/local/lsws/lsphp$phpver/bin/php -i |grep -Ei ‘memory_limit|post_max_size|upload_max_filesize|max_execution_time’ && echo “” ; done; service lsws restart && killall lsphp;

@inspiredearth let me know if that works for you. It does for me on my Ubuntu Cyberpanel version

root@ols:~# stat /usr/local/lsws/lsphp74/etc/php/7.4/litespeed/php.ini File: /usr/local/lsws/lsphp74/etc/php/7.4/litespeed/php.ini Size: 72906 Blocks: 144 IO Block: 4096 regular fileDevice: fd00h/64768d Inode: 1713987 Links: 1
Access: (0644/-rw-r–r–) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2020-05-14 05:15:07.758066391 -0400
Modify: 2020-05-14 05:15:07.550070665 -0400
Change: 2020-05-14 05:15:07.606069515 -0400
Birth: -
root@ols:~# uname -aLinux ols 4.15.0-99-generic #100-Ubuntu SMP Wed Apr 22 20:32:56 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
root@ols:~#