PHP memory limit dont want to change - php

I'm trying to resize my memory limit by change the php.ini
But when I check using phpinfo() the result is this :
the memory limit still the same as default. I've restart MAMP and nothing changed.
I hope someone can help me to solve this. Thank you.

Check the config in phpinfo():
Configuration File (php.ini) Path => path
Loaded Configuration File => path
Is the path the same with the file you changed? Have you restart the apache?

Here is how it works:
Start MAMP PRO
Stop the server if it's running
Choose Menu -> File -> Edit Template -> PHP4 php.ini (If you want to change the memory limit for PHP5, then choose PHP5 php.ini)
The PHP ini file will be opened.
If a dialogue box pops up, read it and confirm with OK
Search (Command-F) for "memory_limit" (without quotes)
You should get the following line:
memory_limit = 8M ; Maximum amount of memory a script may consume (8M)
Now you can change the default value of 8M. For instance. into 32M or even more (like 128M)
Save (Command-S) your changes.
Close (Command-W) the file.
Start the Server.
Credits :
http://blog-en.mamp.info/2009/09/increase-php-memory-limit-with-mamp-pro.html

Most probably you're editing the wrong php.ini configuration file.
Check the Loaded Configuration File from phpinfo() output and make sure you're editing the correct php.ini configuration file.

Related

Why can I not upload files greater than 2MB? Php.ini has already been edited

I'm having the same problem this guy says he had: PHP still won't allow file uploads larger than 2 MB, although apparently he solved it.
I, however, cannot find a solution. I've edited the php.ini file to the following values:
upload_max_filesize = 20M
post_max_size = 20M
I've even tried raising them to 200M, but it still limits it at 2M, according to phpinfo().
Here are some of the variables per php.ini (name, local value, master value):
file_uploads On On
max_file_uploads 20 20
upload_max_filesize 2M 2M
I've restarted everything. The original value when I checked php.ini for upload_max_filesize was 10M anyway. It will upload smaller files, just nothing above 2MB.
Assicure that you have saved your php.ini.
Restart your webserver for example the service of Apache2 if you use it
Print again a page with phpinfo() and assicure that value has changed if not you haven't wrong file to edit.
Assure that html has attribute MAX_FILE_SIZE
Another way is to change in PHP this setting like:
ini_set('post_max_size', '20M');
ini_set('upload_max_filesize', '20M');
It is possible the file size limit is being overwritten in an .htaccess file, or in your PHP application, through ini_set() calls.
I will also remind you that when you change those values in php.ini, you probably need to restart Apache.
If this isn't something your webhost will let you do, you could always use ini_set() calls yourself, in your script. For example, place this near the top of your script:
ini_set('post_max_size', '64M');
ini_set('upload_max_filesize', '64M');
I've had this issue before. If you are running certain versions of web servers, such as running php-fpm with nginx, your php.ini file won't be in the place you expect it. For example, I believe php-fpm doesn't follow the normal php.ini, but rather a www.conf located in it's conf.d directory.
Anyway, check and make sure that your configuration isn't being overridden by a separate php.ini or other config file. If you cannot fix it in this way, you may have luck doing what Richard and Alessandro suggest.
I ran into a similar problem. the setting post_max_size was set to 3M.
I fixed it in the php.ini file from the /wamp/apache/bin folder.
I Hope it helps.
Always ensure that it is the correct php.ini file that you are updating its values.
I spent 2 weeks reconfiguring IIS7 only to realize that there were 2 php.ini files on was in the C:\Program Files (x86)\PHP\v5.4 and the other was in C:\php... however the one that worked was: C:\Program Files (x86)\PHP\v5.4
To ensure that you are on the correct path to the php.ini file
create a phpinfo.php file (structure of file below)
phpinfo();
call the file in the browser like: http://servername/websitename/phpinfo.php
Check the lline shown in pic below to verify that you are indeed editing the correct php.ini file.
Hope this helps cause it helped me. PS. Don't forget to make the changes mentioned above to increase the upload size limit
I also had the same problem and also I did the same changes in the ini.php file
upload_max_filesize = 200M
post_max_size = 200M
But it doesn't solve my problem. So, I went to wamp server in the taskbar (where we can see the green 'W' sign) and left clicked on it
PHP > PHP SETTINGS > upload_max_filesize = 256M (as the changes i made in ini.php were actually not made).
Then it WORKED.
Flogvit pretty much answered my question. WAMP was using a different php.ini file than was listed in the WAMP PHP settings option. I looked at the wamp configuration file and it was just "php.ini." I changed it to the full path of the php.ini file I wanted to use (there was another in the IIS folder), I restarted it and nothing happened. However, after restarting the computer, it now works. For some reason ini_set() doesn't work, however the solution is this:
1) open wampmanager.conf
2) change "phpConfFile = " from php.ini to the full path of the php.ini file you'd like to use, putting it in double quotes.
3) restart the computer that WAMP is on.
Thanks again for the help. That was a pretty weird problem and I don't know why I couldn't just restart WAMP (which runs all the servers, including the Apache server). I'm guessing there was something running outside of WAMP that was being run by WAMP, which is a bit of a mystery to me.
That's because you are editing the wrong config file. Check where your config file is being loaded from and edit that one instead. You might be editing the one located at /etc/php/[version]/cli/php.ini.
In my case, my loaded config file is at /etc/php/7.3/apache2/php.ini

How to change PHP master value of memory_limit

I trying to change the php memory_limit master value but still cant make it.
in htaccess i put 'php_value memory_limit 1024M', it's only change the local value..
Any ideas to change the master value?
Update your php.ini file. If you are on shared hosting without access to it, then your only option is to set it locally.
If you want to change the master value, you'll need to find the php.ini file located on the server. Take a look at https://stackoverflow.com/a/2750582/254973 if you need help finding the file.
Simply edit the value within that php.ini file, and you should be good to go. Maybe a restart of the webserver depending on it's configuration.
This will more than likely require elevated/root access on your hosting server.
Check the location of your php.ini file
php -i | grep php.ini
Configuration File (php.ini) Path => /usr/lib/lib
Loaded Configuration File => /usr/lib/php.ini
Something like this and edit the file with your favorite editor:
notepad, vim, emacs, pico...
pico /usr/lib/php.ini
Search and change memory limit and restart apache.
Change the php ini
memory_limit = 128M
to what you want
I was searching all over the system for this value, it seems it's stored in
/etc/php/8.1/fpm/pool.d/www.conf
I tried to change the memory_limit in these files but didn't change anything:
/etc/php/8.1/apache2/php.ini
/etc/php/8.1/fpm/php.ini
/etc/php/8.1/cgi/php.ini
/etc/php/8.1/cli/php.ini
Don't forget to restart the php and webserver (nginx/apache etc.) service after editing.

Acquia Drupal 7 - php upload limit won't change

I'm working with acquia-drupal 7 (just localhost for now), inside Microsoft WebMatrix.
I can't get my php upload limit to increase from the default 2MB. Having googled around I have done the following:
added to every existing htaccess:
php_value upload_max_filesize 10M
php_value post_max_size 10M
created php.ini file in every dir that had an htaccess (no php.ini files existed anywhere) containing the following:
upload_max_filesize = 10M
post_max_size = 10M
Restarted the site (through the Webmatrix GUI)
No apparent change whatsoever after any of this - my site still has the 2MB upload limit.
Thoughts?
The reason your changes are not taking affect are because you just created a php.ini file anew, rather than finding the one that is being used.
By definition, since you just created it, it won't be the one that exists in your php directory. :-)
But don't worry! There's an easy way to find the correct php.ini file that your site is using:
Go to /admin/reports/status on your drupal site. Here you will see information about which version of php and apache you're using, etc.
The line for 'PHP' on that page should have both the version of php you're using (something like 5.3.6) and a 'more information' link
Click on that link and you should be able to see detailed information about the php installation on your machine.
Find the line called 'Configuration File (php.ini) Path' on that screen and navigate to that to update it.
Just like you already knew, make sure you restart your server after any changes. :-)
Let us know if this fixes your problem!
Have you ever ran into a problem where you needed to upload relatively large files and still want to be able to manage these from the Drupal 7 administrative interface? If so, you may run into a situation like the one below:
You will notice the 12 MB text stating that we can only upload files that are 12 MB and under. In this case I needed this number to be a little bigger.
In order to do this you will need to modify your PHP settings in your php.ini file.
Note: You should make sure you know what you are doing and understand the consequences of increasing this number. In my case this is on a site that only users that I trust will be uploading files. If you allow any user to upload files, increasing this number can add an increased load on the server and possible eat up your disk space pretty quickly.
Now that you have been warned, here is how I was able to do this. I first found the php.ini file on my system. I am on an Ubuntu server so I was able to get to edit mine using vim like so:
vim /etc/php5/apache2/php.ini
Change the upload_max_filesize setting
The first step was to find the upload_max_filesize setting from 12MB to 30MB.
Change:
To:
Change the post_max_size setting
You may also need to modify the post_max_size setting. I changed the post_max_size php.ini setting from 20MB to 30MB.
Change:
To:
Restart Apache
You should check phpinfo to make sure your php.ini which you edited is the correct one.

How to import table in phpmyadmin? I got error of file size

I want to import database in phpmyadmin but i got error like this...
"No data was received to import. Either no file name was submitted, or the file size exceeded the maximum size permitted by your PHP configuration."
my file size is 4.8 mb,
please give me solution....
Follow theses steps
Go to the PHP folder -> search for php.ini
Seach for the below line and change it according to your need.
; Maximum allowed size for uploaded files.
upload_max_filesize = 2M
Restart the server to confirm changes.
try to edit after change into php.ini :
upload_max_filesize = 10M
post_max_size = 20M
memory_limit = 128M
also change the value of max_execution_time
EDIT:
if you want then do all that stuff with command line:
mysql -h[Host Name] -u[User Name] [Database Name]<[SQL File Name] -p
through this you will import the database..
Copy the data from the file, put it into the sql tab of phpmyadmin, and press the "Go" button.
You need to edit the php.ini file for changing the file size. the line is
upload_max_filesize = 2M
You need to change the file size that you need to import.For ex: if you need to import a 10 mb file,then change it into
upload_max_filesize = 10M
Then restart your server.
I had the same problem. Here is the solution:
you need to edit the variable for max_upload_size in php.ini file
so do the following:
locate php.ini
it will show you the location of that file
enter the file by
sudo gedit /etc/php/7.0/apache2/php.ini
enter password
find the variable and edit the value to as much as you want
save it and exit
now restart your server
service apache2 restart
and done!!
You need to make sure that your file size options are set to suitable values in the correct file. On my system there are 3 files called php.ini inside /etc/php/7.0 (Linux Mint 18.1 Cinnamon) but only one of them is being used.
The instructions here tell you how to find which file to edit:
Create a file var/www/html/phpinfo.php. Paste this code into it and save it:
<?php phpinfo() ?>
Then in a browser navigate to http://localhost/phpinfo.php
This displays your php configuration, look for the option "Loaded Configuration File", it should be near the top of the page. This will give you the location of your php.ini file, on my system it's /etc/php/7.0/apache2/php.ini
Now open that file (don't forget to open it as root so you can save changes) and increase the allowed file size to a value larger than your sql file, for example:
upload_max_filesize = 20M
If that doesn't do the trick, you can try increasing the values for these settings also:
max_execution_time
max_input_time
memory_limit
post_max_size
Increase the upload file size limit in the server. If you don't have access to it try breaking the file into parts, for different tables. Or you may use MySQL Dumper.
I had the same problem with WAMP. I even tried changing the limit going back to php.ini for max_upload_limit but still it didn't work. I went back to my mac and tried on MAMP and i had no issues at all. BTW I figured out that... the max limit size set in WAMP is 2084KiB where as in MAMP is 32MiB.
If you even refer to the documentation from PHP in the FAQ_16 it talks about the max_upload_limit in php.ini.
Documentation.html#faq1_16
a very userful link is below:
http://www.magentocommerce.com/wiki/magento_filesystem_permissions
If you are using XAMPP in Ubuntu
Follow theses steps
/opt/lampp/etc/php.ini
Seach for the below line and change it according to your need.
; Maximum allowed size for uploaded files.
upload_max_filesize = 2M
In Ubuntu 18.04 apache2 does change the upload size on the below php.ini file :
root#xxxxxxxxxx:/etc/php/7.2/apache2# pwd
/etc/php/7.2/apache2
root#xxxxxx:/etc/php/7.2/apache2# vi php.ini
Open php.ini file
(Open xampp-control-panel. In front of Apache, there is a config button. Click on that and php.ini will be opened).
In php.ini there is
upload_max_filesize=2M
update it to
upload_max_filesize=10M
(you can update it as per your requirement)
After this, you have to restart apache in xampp-control-panel

cannot change php max_memory in php.ini

I am trying to change the max_memory parameter so I went into my php.ini and set max_memory = 500M For some reason, when I use phpinfo(), that setting still displays 128M (the default setting). I read that some hosts restrict max_memory. Is there a way to change this value manually, or override this option in a config file, or do I have to recompile php?
If you can recompile PHP, then you, obviously, have full control of the web server.
I would guess, as written in the comments, you:
Did not restart the Apache (or not the right Apache)
(as you found) You are editing the wrong ini file.
Your server simply don't have 500MB free memory
a few other things to check:
the report from phpinfo states that it is using the php.ini file that you're editing, not some more "specific" .ini file somewhere else
you haven't overridden the memory_limit variable through an apache .htaccess file or using ini_set in a PHP script somewhere
if you're in a shared environment, as Itay suggests, you may not have more than 128M available to your account, and you probably don't have access to reset apache either.
if that's the case, try making the value smaller to see if the changes you're making take effect. If they are, and you can't increase it above 128M, time to upgrade your hosting account.. otherwise, try making the change through .htaccess or ini_set in your script because those methods don't require an apache restart.
if you still can't get it to work, contact the host and ask them to make you a local copy of the global php.ini file for your account.

Categories