What's wrong with my php.ini? - php

i'd like to know whats wring with my php.ini because I cant attach any file more than 200kb. I've already modified the upload_max_filesize and my post_max_size but still nothing happens. I'm using xampp, localhost and php mail() function. Every comment will be much very appreciated. thank you
; Maximum allowed size for uploaded files.
; http://php.net/upload-max-filesize
upload_max_filesize = 20M
; Maximum number of files that can be uploaded via a single request
max_file_uploads = 20
; Maximum size of POST data that PHP will accept.
; Its value may be 0 to disable the limit. It is ignored if POST data reading
; is disabled through enable_post_data_reading.
; http://php.net/post-max-size
post_max_size = 40M

Many time upload_max_filesize didn't work on windows (xampp and wamp) . I recommend to switch to LAMP Or if you have to upload database you can use MYSQL workbench on windows system .

Related

phpMyAdmin File Limit (already edited php.ini)

I'm trying to import a 151 MB database into phpMyAdmin and am getting the error "You probably tried to upload a file that is too large. Please refer to documentation for a workaround for this limit."
I've already edited php.ini with values of upload_max_filesize, memory_limit and post_max_size that more than accommodate this file. Is there anything else I can do to troubleshoot?
Try setting max_execution_time and max_input_time with higher values.
max_execution_time = 90
max_input_time = 120
You might want to try memory_limit as well and don't forget to restart the server.

Import file in MAMP(file size exceeded the maximum size permitted)

I want to import a file(85 MB) at my local server.
I changed in the php.ini the following values of the three variables (upload_max_filesize, memory_limit and post_max_size) exactly as I saw at same problems, with the right order, I restarted my MAMP server and my laptop but it didn't change anything and I can't import files more than 2 MB.
Can you give any advise to fix it ?
You need to edit the php.ini file for the php version you are using. i.e. v7.2.1.
First check which version you're using by going to
MAMP-> Preferences -> PHP -> Select/Specify PHP Version
Then go to /Applications/MAMP/bin/php/php7.2.10/conf/php.ini and input the new settings there.
Stop your server and restart MAMP. Import should now run as expected.
Cheers.
Once you find out which version of PHP your MAMP is running, find the php.ini file at C:\MAMP\conf\php7.2.10\php.ini.
You'll need to change BOTH upload_max_filesize and post_max_size. If you only update the first, it'll default to the post_max_size.
Restart the MAMP and you should be good to go.
First check your PHP version
then according to your php version you have to go this php version file (php.ini)
and the change like below... :)
post_max_size = 256M
; Maximum allowed size for uploaded files.
upload_max_filesize = 256M
; Maximum execution time of each script, in seconds
max_execution_time = 600
; Maximum amount of time each script may spend parsing request data
max_input_time = 600
; Maximum amount of memory a script may consume (8MB)
memory_limit = 512M
I did all these things but nothing happened.I have two files with the name "php.ini",the first is "php.ini-development" and the second is "php.ini-production".Because i don't know which is the correct file to change the values,i changed the values and at the two because my phpinfo have like a Loaded Configuration File this:"C:\MAMP\conf\php7.0.13\php.ini" and not one of the two.
If you are seeing timeouts, you can increase max_execution_time and max_input_time.

Changing post_max_size to 512M not being affected on WAMP

I have read other answers here on stackoverflow, however this is a really weird issue.
My phpinfo() shows that I have set 512M for the post_max_size (I have also increased other properties to at least 512M)
However when I am trying to send post request from Angular HTTP to Laravel 5.2 api, I get 422 Unprocessed Entitym and php_error says:
PHP Warning: Unknown: POST Content-Length of 7323588 bytes exceeds the limit of 3145728 bytes in Unknown on line 0
I have changed both php.ini files,despite only one being loaded.
Step 1: Go to the folder destination where you have installed WAMP. (Usually it is C:)
Step 2: Now locate and open php.ini files from both these locations. (C:\wamp\bin\apache\Apache2.4.4\bin and C:\wamp\bin\php\php5.4.16)
Step 3: Now in both the documents press CTRL+F and find out the following settings.
post_max_size
upload_max_filesize
memory_limit
For example you will see upload_max_filesize = 2m where m is MB. Change 2m to 500m or more as you like.
Change post_max_size = 8m to post_max_size = 700m or more. Change memory_limit = 8m to memory_limit = 1000m.
Other than that to avoid fatal errors like maximum time of something exceeded in line something, find and change the following values.
max_execution_time = 30 to to max_execution_time = 3000 and max_input_time = 60 to 3000.
This was an interesting problem.
The issue was following:
Yes, I needed to change the post_max_size, however at one point in my php.ini I had it set to 1000M.
My Apache 2.4.9 , and PHP 5.5.12 decided to ignore the suffix M and I ended up with a limit of 1000 Bytes.
My solution was to set post_max_size = 1000000 to have the limit set to 1MB

How to Fix Script Timeout Error in phpMyAdmin?

I am getting script timeout issue while importing a database from a zip. The error shows as-
Script timeout passed, if you want to finish import, please resubmit
same file and import will resume.
I tried setting $cfg['ExecTimeLimit'] = 0; inside phpmyadmin4.1.14/libraries/config.default.php.
Also inside my php.ini I set both max_input_time and max_execution_time to 0.
The zip size is around 33 MB and I'm using WAMP server.
What could be the other cases for which I'm getting this error?
Since you get script time out, shouldn't you increase the max_execution_time in php.ini instead of reducing it?
Try with the following values:
post_max_size = 500M
upload_max_filesize = 500M
max_execution_time = 300
max_input_time = 540
memory_limit = 1000M
EDIT: just noticed that max_execution_time is hardcoded to 0, still you can try the above settings.
Please be aware that apache also has an execution time.
Apache Wait Time for Input/Output
Edit file C:\WampDeveloper\Config\Apache\extra\httpd-default.conf
Timeout = 300
This issue commonly arise when we working on heavy load php application. This error comes when you are getting bulk of data from database. Then this type of issue come. You should check the following things in you code.
Check you database queries properly.
With Select statement you should use the Limit offset.
Check each table should have the primary key.
This issue also come when we are upload images or some thing like wise. Some time we did get solution for the heavy load image's then we try to change the logic and try to solve the issue. One more thing that you should check you php.ini configuration setting Increase these values in MB.As follows.
post_max_size = 500M
upload_max_filesize = 500M
max_execution_time = 300
max_input_time = 540
memory_limit = 1000M

upload large file in php

How can I upload files larger than 2MB in PHP,I searched the Internet and i changed the php.ini file,the line is: "upload_max_filesize = 200M",but I still can't upload even 2 MB file.
What seems to be the problem?
Please help me.Thanks in advance.
Once upon a time I'm facing this problem with my WAMP server, and when I search for solution, I stumbled upon to this discussion. So, if someone have the same problem, this is my working solution, I hope this help:
I'm using WAMP stack. By reading your comment above, you are using WAMP stack too. In case you don't know, WAMP server has 2 (two) php.ini (in PHP directory and Apache directory) configuration, one for CLI and the other for Apache itself ( see php.ini on WAMP server ). So, I create info.php to detect which php.ini use by my server, and in my case that is the one in Apache directory ( see Which PHP Ini file does my WAMP webpage uses?).
Open your php.ini that used by your server, and as #Pascal Martin suggested, change upload_max_filesizeand also set post_max_size then restart your server.
Check again your info.php, make sure the value of upload_max_filesize and post_max_size has changed to your desired value.
Restart Apache.
It's worked for me, hope this help.
As you guessed, you have to set upload_max_filesize...
But you also have to set post_max_size (quoting) :
Sets max size of post data allowed.
This setting also affects file
upload. To upload large files, this
value must be larger than
upload_max_filesize.
There are also other options which could limit this:
max_input_time = 600
php_value max_execution_time = 600
post_max_size = 200M
(...and restart Apache)
get your php.ini-dist file,
edit it to set proper values shown above
rename it to php.ini
copy it in WINDOWS directory
restart Apache
Put the following code in side the .htaccess file and save it.
php_value upload_max_filesize 200M
php_value post_max_size 200M
php_value max_input_time 2000
To upload the larger file, one needs to change/increase the value of both post_max_size and upload_max_filesize directives from the php.ini file.
upload_max_filesize = 200M
post_max_size = 201M
This will increase upload limits on a single file to 200 MB, from the default of 2 MB.
To upload a large file ( >5MB), I use the chuck upload method.
/**
* #param $file
* #param $fileSize
* #param $name
* #return int
*/
public function chunkUpload($file, $fileSize, $applicantID, $name) {
$targetFile = 'upload/'. $name;
$chunkSize = 256; // chunk in bytes
$uploadStart = 0;
$handle = fopen($file, "rb");
$fp = fopen($targetFile, 'w');
# Start uploading
try {
while($uploadStart < $fileSize) {
$contents = fread($handle, $chunkSize);
fwrite($fp, $contents);
$uploadStart += strlen($contents);
fseek($handle, $uploadStart);
}
fclose($handle);
fclose($fp);
return 200;
} catch (\Exception $e) {
return 400;
}
}
Changed the server settings in this way...
memory_limit = 250M //The maximum amount of memory in bytes a script is allowed to allocate.
max_input_time = 600 //The maximum time in seconds a script is allowed to parse input data.
max_execution_time = 600 //The maximum time in seconds a script is allowed to run before it is terminated.
post_max_size = 200M //The maximum size in bytes of data that can be posted with the POST method. Typically, should be larger than upload_max_filesize and smaller than memory_limit.
upload_max_filesize = 100M //The maximum size in bytes of an uploaded file.
Try setting it with within PHP script (on top)..
ini_set("upload_max_filesize", "255M");
ini_set("post_max_size, "256M");

Categories