Remove the file upload size restrictions for various PHP spaces

Remove the file upload size restrictions for various PHP spaces

Of the following three methods, the first one succeeded, while the second and third ones failed.
1. If it is a VPS, you can modify php.ini directly. Open php.ini, search for the following configuration items (red characters), and then modify them as needed. You can use the reference values ​​below. Remember that you must modify the default configuration items after searching for the code, and you cannot copy and paste directly!

upload_max_filesize = 20m; //The maximum size of the uploaded file allowed
post_max_size = 20m ; //The maximum value that can be received by PHP through form POST
max_execution_time = 600; //The maximum execution time of each PHP page (in seconds)
max_input_time = 600; //The maximum time (in seconds) each PHP page waits for receiving data

2. If it is a Linux space, you can remove the restriction by modifying the .htaccess file. Open the .htaccess file in the root directory and add the following code. You can copy and paste it directly. Of course, you can also modify the relevant parameter values.

*The maximum size of the uploaded file allowed
php_value upload_max_filesize 20m
*The maximum value that can be received by PHP through form POST
php_value post_max_size 20m
*The maximum time (in seconds) for each PHP page to run
php_value max_execution_time 600
*The maximum time (in seconds) each PHP page waits for receiving data
php_value max_input_time 600

3. Modify the theme configuration file to remove the restriction, open functions.php with Notepad++, and add the following code between <?php and ?>:

@ini_set('upload_max_size', '20m'); // Maximum size of uploaded files
@ini_set('post_max_size', '20m'); //The maximum value that can be received by PHP through form POST
@ini_set('max_execution_time', '600'); //The maximum execution time of each PHP page (in seconds)
@ini_set('max_input_time', '600'); //The maximum time (in seconds) for each PHP page to receive data

<<:  Zyma – Free unlimited hosting for a year

>>:  $15/year/2G space/40G traffic virtual host——LevelHosting

Recommend

8 cheapest foreign hosting averages 10$ per year

Introducing 8 of the cheapest foreign hosting ser...

Stable and cost-effective virtual host recommendation

1. Site5 The price is higher, there are many data...

LAUNCH VPS: $24/year/512MB RAM/10GB SSD space/512GB bandwidth/KVM/Philadelphia

LAUNCH VPS, an American hosting provider, mainly ...

MrRapidHost: $15/year/1 CPU/512MB/20GB/250GB traffic/1 IP/OpenVZ

MrRapidHost is a US hosting provider that has jus...