How to set PHP Max_Input_vars? - php

I am using PHP version 5.6.12 on an Apache server and I am having a hard time setting Max_Input_Vars. I have looked online and I have inserted the following into my php.ini file.
php_value max_input_vars 5000
php_value suhosin.get.max_vars 5000
php_value suhosin.post.max_vars 5000
php_value suhosin.request.max_vars 5000
However, when I look at my phpinfo this variable is still set to the default 1000.How can I set this to 5000?

Related

connection reset when upload file with size more than 1GB

I try to upload file to my own website when I try upload file with less than 1GB it's work fine, But when I try with large file give me message : "The connection was reset." ERR_CONNECTION_RESET
Then I try to edit and increase all value php.ini
php_value max_execution_time 10000
php_value max_input_time 10000
php_value max_input_vars 1000
php_value memory_limit 2000M
php_value post_max_size 2000M
php_value session.gc_maxlifetime 10000
php_value upload_max_filesize 2000M
In the end still have a problem
I work on my own server and I have access to whm, cpanel with centos 7
And there's no logs for this problem on apache logs
Can you check the features of the package you added on WHM? The quota of the package you have added may be low.

Background Process Stops after 5 minutes - PHP and WordPress

I am running a WordPress website, which runs CRON for very large data. Typically the CRON runs for 2 to 2:30 hours.
But from last 2 days, I am facing an issue like my CRON process is getting stuck after 5 minutes i.e. 300 seconds
I have tried to resolve this using the below solutions:
Added set_time_limit(0); in wp-config.php file.
define( 'WP_MEMORY_LIMIT', '4096' );
set_time_limit(300);
define( 'WP_MAX_MEMORY_LIMIT', '4096' );
Added php_value max_execution_time 18000 in .htaccess file.
<IfModule php7_module>
php_value max_execution_time 18000
php_value max_input_time 6000
php_value memory_limit 4096M
php_flag display_errors Off
php_value max_input_vars 1000
php_value post_max_size 8M
php_value session.gc_maxlifetime 1440
php_value session.save_path "/var/cpanel/php/sessions/ea-php72"
php_value upload_max_filesize 2M
php_flag zlib.output_compression Off
</IfModule>
In /etc/apache2/conf/httpd.conf file, increased the Timeout variable with value 5000
Increased value of FcgidBusyTimeout with 5000
None of the above solutions worked for me.
Anyone can help to find where is the problem with this cron or with other validation steps?
I have posted this to server support guys as well, and they came up with the solution.
Anyone having the same issue can try modifying values:
In my case, Filename: /etc/apache2/conf.d/lsapi.conf
lsapi_poll_timeout 18000
lsapi_backend_max_process_time 18000
After applying these changes, you need to restart the APACHE server for reflecting the changes.
Applying these changes worked for me.

Increasing Execution Time for php

Update: This is not a dublicate question! I researched and tried many options/answers, but still, the web page is not allowing users to upload a file after exactly 20 seconds.
Update: I tried to switch from fast-cgi to php-fpm, but it did not work for me either. What else should I change in order to overcome timeout of 20 seconds?
When I am uploading large files via web browser, exactly after 20 seconds, it stops uploading. Specifically, approximately 40% of 100 MB file uploads fine during 20 seconds; I see the percentage of the upload under the Chrome browser. Then, the value of the percentage stops after 20 seconds and shows ERR_CONNECTION_RESET error. I checked logs, but there is nothing regarding the issue.
My php.ini configuration as follows:
max_execution_time 300000
max_input_time 300000
upload_max_filesize 500M
post_max_size 500M
memory_limit 1024M
max_file_uploads 30
Timeout 8000 (in apache2.conf)
LimitRequestBody 0 (in htaccess)
What else should I change in order to increase an execution time? Obviously, there is some config that does not allow to upload a file after 20 seconds. My assumption is that there is something in Apache Configuration that must be tuned.
<IfModule mod_php5.c>
php_value post_max_size 100M
php_value upload_max_filesize 100M
php_value memory_limit 100M
php_value max_execution_time 300000
php_value max_input_time 300000
php_value session.gc_maxlifetime 1200
</IfModule>
insert this in .htaccess file. try whether its working or not
you should change max_input_time,upload_max_file_size and post_data_limit in php.ini file. It should work.
change values
max_execution_time 25000
max_input_time 25000
memory_limit 500M
display_errors On ;to see where is problem
post_max_size 500M
upload_max_filesize 500M
and restart your apache or nginx tu load changes
in ubuntu you can use this command to restart apache sudo service apache2 restart

Adding max_input_vars 3000 to my .htaccess file and php.ini not working

I've done some searching and seems everything I've read and tried with adding max_input_vars 3000 to my .htaccess and php.ini is not working. I've reached the limit on custom fields and can't get the max increased. I added these lines and restarted apache but nothing helps.
Here is what I added to .htaccess:
php_value max_input_vars 3000
php_value suhosin.get.max_vars 3000
php_value suhosin.post.max_vars 3000
php_value suhosin.request.max_vars 3000
And here is my php.ini:
max_input_vars 3000
suhosin.get.max_vars 3000
suhosin.post.max_vars 3000
suhosin.request.max_vars 3000
Repost from:
[https://stackoverflow.com/a/29312220/3827361][1]
I had the same issue, and I fixed it by setting max_input_vars value in this php.ini: /etc/php5/apache2/php.ini
even though php_info() reported a different php.ini used (/etc/php5/cli/php.ini). BTW, before I stumbled upon the solution, I also tried setting up the value in .htaccess (in the web page root directory), with no effect.
This looks like a possible bug in PHP 5.5. In any case, I suggest locating all php.ini files on your server ("locate php.ini") and setting max_input_vars in all of them (or the first one that works, eh). Don't forget to restart Apache so this takes effect (sudo /etc/init.d/apache2 restart)
BTW, my PHP Version is 5.5.9-1ubuntu4.5, installed on Ubuntu 14.04.
You can change your max_input_vars value to 2000 or any value that you want in htaccess by adding this for PHP 7.*:
<IfModule mod_php7.c>
php_value max_input_vars 2000
</IfModule>
And for PHP 8.* use this:
<IfModule mod_php8.c>
php_value max_input_vars 2000
</IfModule>

Changes to max_input_vars in my php.ini aren't reflecting

I found the location of my php.ini file on my windows server and changed the max_input_vars line from 1000 to 3000 and changed post_max_size to 16m and rebooted my server. Now, the post_max_size changed, but the max_input_vars didn't when I check phpinfo.
I even searched my server for other variations of my php.ini file and changed max_input_users in those, as well, including php.ini.development and another one. Still no change when I look at my phpinfo.
I also thought maybe sehosin was installed, so I added the lines:
suhosin.request.max_vars = 3000
suhosin.post.max_vars = 3000
Still, my max_input_vars = 1000.
How does one change this value??

Categories