post_max_size resets to default - php

Scenario: Installed an adult tubescript for a pornsite. Keeps having problems with file upload over 8MB
I figured it has something to do with php.ini, so I checked and changed it to
post_max_size = 200M
upload_max_size = 200M
On .htaccess of the script, there is these two lines:
php_value upload_max_filesize 1000M
php_value post_max_size 1000M
but when I check using phpinfo(), post_max_size is still 8M and I still can't upload anything over 8MB. I've been working on this for 3 days now and I really can't figure it out.
What could possibly be causing this?
Dedicated Server: FreeBSD 8.2, Nginx 1.0.6, PHP 5.2

I've learned that Nginx needs a php feeder/loader: fastcgi
In my case it's spawn-fcgi
here's how I fixed it
/usr/local/etc/rc.d/spawn-fcgi restart
/usr/local/etc/rc.d/nginx restart
Thanks for the replies.
Credits to DarkZenith for the pointers.

Related

aws ubuntu instance php maximum file upload not changing

I am using aws instance for my file uploading functionality ( ubuntu php 7.0)
when printing phpinfo(), it shows upload_max_filesize as 2M.
I need to upload larger images upto 10 MB.
I have changed lines in php.ini files with upload_max_filesize to 30M which is found in the folder /etc/php/7.0/apache2/php.ini. and /etc/php/7.0/cli/
no effect and restarted the server with ssudo /etc/init.d/apache2 restart
There is no effect in the phpinfo result.
I created a php.ini and put it in the root folder with the lines
upload_max_filesize = 960M
post_max_size = 960M
and tried uploading lager files , it is not working
Then I have created .htaccess with the lines
php_value memory_limit 30M
php_value post_max_size 100M
php_value upload_max_filesize 30M
and tried lines in the PHP uploading script
ini_set('post_max_size', '64M');
ini_set('upload_max_filesize', '64M');
The above actions do not help me in larger files, please help. me.
Have you restarted your web server after making changes ?
You need to Change these two things "post_max_size, upload_max_filesize" in /etc/php/7.0/apache2/php.ini then definitely it will work.

Changes in file "php.ini" doesn't have any effect

I need to upload file more than 100 MB, yii\web\UploadedFile. I am using Linux, CentOS 7.
I did:
check path to php.ini in phpinfo()
add in php_value upload_max_filesize 512M php_value post_max_size 512M in php.ini
restart the LAMP server (lampp) and run phpnfo() to check, but nothing changed. Although php.ini changed.
restart my PC and start the LAMP server, but still no changes in phpnfo().
I have found some solution to add additional.ini.files, but in my phpinfo():
Scan this directory for additional .ini files (none).
I solve this by adding this in file .htaccess:
php_value upload_max_filesize 512M
php_value post_max_size 512M
But the problem still exists. I can't influence file php.ini.
The syntax php_value ... only works in .htaccess files.
To change the value in the php.ini file, you dont' need the php_value part. Search the file for the upload_max_filesize attribute, it's most likely already there and change the value to 512M.
If the line starts with a ; remove it as this comments the line. Do the same for the post_max_size attribute.
If these attributes does not exists yet, add them to the end of the file:
upload_max_filesize = 512M
post_max_size = 512M
After editing the file you need to restart PHP and Apache.

echo $_FILES['data-file']['tmp_name']; die; file name is not printed if size more then 128M in PHP

I try to upload file of 300 MB. but not uploaded and now display any error.
variables value in php.ini file is
post_max_size 800M
upload_max_filesize 750M
memory_limit 2048M
max_execution_time 17100
max_input_time 17100
if i try to print tmp name of file by echo $_FILES['data-file']['tmp_name']; die; Nothing display page redirecto to home. but for less then 128M it show /tmp/phpShle like that.
If you are on LAMP make sure you are editing right php.ini file. In LAMP you will find cli related php.ini and php-apache related php.ini. To make above scenarios of file upload possible, you will need to edit php-apache php.ini file which is in /etc/php5/apache2/ and also restart apache service.
If you are on WAMP, it has only one php.ini and WAMP is automatically restarting services after editing file. So it should work.
-Or-
You can write a .htaccess file in web home directory.
RewriteEngine on
php_value post_max_size 300M
php_value upload_max_filesize 300M
Please write this on .htaccess.
<IfModule mod_php5.c>
php_value post_max_size 256M
php_value upload_max_filesize 256M
php_value memory_limit 500M
</IfModule>
This might help you. Cheers :)
My proble is solved. I need to set these variable on modsec2.user.conf file
SecRequestBodyLimit 1073741824
SecRequestBodyNoFilesLimit 1073741824
This is a apache server file. and error was shown on Apache error log.

Cannot upload files bigger than 10MB

I'm trying to let user upload up to 30MB max but the server hangs not even produce an error. Not even error in browser network bar in inspection. I did changes below after reading whole lot of info on Internet but no luck so far. Anyone knows what else I can do?
Thanks in advance
.htaccess:
<IfModule mod_php5.c>
php_value post_max_size 40M
php_value upload_max_filesize 350M
php_value max_execution_time 1200
php_value max_input_time 1200
</IfModule>
/etc/php5/{cli,fpm}/php.ini
post_max_size 40M
upload_max_filesize 35M
max_execution_time 1200
max_input_time 1200
RESTART:
sudo service php5-fpm restart
sudo service apache2 restart
For others who could face this issue, there could be also Apache's ModSecurity setting SecRequestBodyLimit (in case of using Apache) and in system log you'll get the following error:
ModSecurity: Request body (Content-Length) is larger than the configured limit (10485760)
One thing to check is the maximum post size set in the PHP Suhosin security patch. This complements the settings in your php.ini and might cause the issues that you're seeing. A similar question here: https://serverfault.com/questions/486134/php-cant-increase-maximum-upload-limit
Let me know if it worked.

PHP post_max_size won't set

searched through any Thread but couldn't find a solution.
I want a post_max_size as large as 20MB for Zurmo
I'm running a Centos 6.5 Server with Plesk12.
I edited the php.ini to the following.
memory_limit = 256M
file_uploads = On
upload_max_filesize = 20M
post_max_size = 20M
But still Zurmo is saying
PHP post_max_size setting is: 8M minimum requirement is: 20M
When I go into the php.ini the value is set on 20M.
I restarted the Apache several times, even rebootet the Server, and now I'm stuck.
EDIT://
I also created a info.php to see if it see another Value, but it still sees the 8M instead of 20
//
Anyone has an idea what I am doing wrong?

Categories