Can't change max_input_vars limit in php.ini - php

I need to change PHP max_input_vars variable but after change in php.ini and server restart phpinfo shows old value all the time. This is what i do:
in phpinfo() i've got
...
Loaded Configuration File /etc/php.ini
...
max_input_vars 1000
from server CL I've edit /etc/php.ini and uncomment line with max_input_vars it looks like this:
...
max_input_vars = 5000
...
after this changes and restarting web server
systemctl restart httpd
phpinfo still shows max_input_vars as 1000
It looks like php use some other php.ini or values are overwritten because with other settings like max_execution_time is the same.
If i'm doing it wrong way? Is this possible that phpinfo shows different configuration file than the one used?
phpinfo output:

As you're using PHP-FPM, you need to check it's configs for overrides, typically in /etc/php-fpm/*.conf.
php_admin_value[max_input_vars] = XXX
After validating there are no overrides that affect your settings, restart the php-fpm service and as a best-practice also Apache.
systemctl restart php-fpm httpd
Restarting the PHP-FPM service is required because Apache passes requests to the running PHP instance(s) loaded into memory from the PHP-FPM service. As PHP is already loaded into memory by PHP-FPM, the PHP-FPM service needs to be restarted for PHP configuration changes to be applied.
Apache prior to PHP-FPM typically relied on starting the PHP process using the Apache mod_php, thereby requiring the restarting of the Apache service for configuration changes to be applied immediately, or until mod_php reloaded the PHP instance.
Based on your configuration, you should add additional PHP config settings to /etc/php.d/zzz-custom.ini instead of /etc/php.ini. PHP will load the config files in alphabetical order, resulting in the zzz-custom.ini file being loaded last and be used as the final values of the PHP settings.
Using the /etc/php.d/zzz-custom.ini file will also prevent the loss of your custom php.ini settings and the need to make extensive changes to the default /etc/php.ini file when updating PHP versions.
However, /etc/php-fpm/*.conf settings will take precedent over any /etc/php.d/*.ini configs.

first: Method is edit the PHP. ini file
Locate your PHP. ini file. ...
If you find your existing PHP. ini, open the file and locate the following line of code (xx represents a number): max_input_vars = xx ; And set it to your desired limit. ...
If you created your own PHP. ...
Save your changes, and reboot your localhost or your server.

Related

phpinfo shows allow_url_fopen is Off. It is On in php.ini

I'm trying to run a php website with nginx using php8.1 and php8.1-fpm, in a Ubuntu 20.04 vps.
phpinfo reports that the config file in use is: /etc/php/8.1/fpm/php.ini
It also reports that allow_url_fopen is Off (both Local Value and Master Value).
Examining /etc/php/8.1/fpm/php.ini shows:
allow_url_fopen = On
I suppose that's the default setting. But I need this value to reflect in phpinfo and I can't get that to work.
I've tried changing the value, restarting nginx and fpm, changing it back and restarting again, but nothing works. Feels like phpinfo is getting its values elsewhere. I've checked all files in /etc/php/8.1/fpm/conf.d (the config folder reported by phpinfo) and there is no allow_url_fopen in any of those.
How do I get allow_url_fopen to be On?
Type “php --ini” command to find the location of the PHP configuration file.
On the above server, you can see that the PHP configuration file is in location “/usr/local/lib/php.ini”
Edit the php.ini file to enable allow_url_fopen.
root#server [~]# vi /usr/local/lib/php.ini
allow_url_fopen = On
Change the line “allow_url_fopen = Off” to “allow_url_fopen = On”
Save the php.ini file after changing allow_url_fopen to On.
Restart the apache service after enabling allow_url_fopen.
Now, allow_url_fopen is enabled globally for all domains on your Server. allow_url_include = On
On some systems there's a file /etc/php.d/security.ini or /etc/php/8.1/fpm/conf.d/99-security.conf in which allow_url_fopen is turned of. If present it overrides the settings in php.ini system wide.
Unfortunately this file isn't listed by php_ini_scanned_files().

Directive 'safe_mode' is no longer available in PHP in Unknown on line 0

I have got this error PHP Fatal error: Directive 'safe_mode' is no longer available in PHP in Unknown on line 0 when I have updated my hosting PHP version from 5.6 to 7.2
how can I solve this problem or I must contact my hosting provider ?!
here is my php.ini setting file found in my mean path
; cPanel-generated PHP ini directives, do not edit
; Manual editing of this file may result in unexpected behavior.
; To make changes to this file, use the cPanel MultiPHP INI Editor (Home >> Software >> MultiPHP INI Editor)
; For more information, read our documentation (https://go.cpanel.net/EA4ModifyINI)
magic_quotes_gpc = Off;
register_globals = Off;
default_charset = UTF-8;
memory_limit = 64M
max_execution_time = 36000
upload_max_filesize = 999M
safe_mode = On;
mysql.connect_timeout = 20;
session.auto_start = Off;
session.use_only_cookies = On;
session.use_cookies = On;
session.use_trans_sid = Off;
session.cookie_httponly = On;
session.gc_maxlifetime = 3600
allow_url_fopen = On
display_errors = On
;error_reporting = E_ALL;
allow_url_include = On
enable_dl = On
file_uploads = On
max_input_time = 60
max_input_vars = 1000
post_max_size = 8M
session.save_path = "/var/cpanel/php/sessions/ea3"
zlib.output_compression = Off
First, you should read up on safe_mode. In the docs, will see that:
Warning: This feature has been DEPRECATED as of PHP 5.3.0 and REMOVED as of PHP 5.4.0.
Second, you can get the error to go away by removing this line:
safe_mode = On;
NOTE: You must be certain to find the correct INI file. Some operating systems or methods of installing PHP will have a separate php.ini file for the web server and Command Line Interface (CLI). For example, on my ubuntu workstation, I have one for apache and one for CLI:
/etc/php5/cli/php.ini
/etc/php5/apache2/php.ini
To find out what INI file you should edit, I suggest looking at the output of phpinfo() and looking at the value for Loaded Configuration File. To do that on a web server, use this file:
<?php
phpinfo();
If you want to find out where the php.ini file is for CLI scripts, you can use this command:
php -i | grep "Loaded Configuration File"
If you are make changes to the ini file for your web server, you'll need to restart the web server for this change to take effect. On Ubuntu or other debian-based distros, you might do that with a command like so:
sudo service apache2 restart
You may need to tweak that command, depending on distro, distro version, apache version, etc. I believe that for CentOS or Red Hat-based distros, one of these should work:
sudo service httpd restart
sudo apachectl restart
NOTE: If your machine is configured to use php-fpm for handling PHP requests, then things work differently for your web server. Your system will maintain a process pool of PHP processes entirely separate from your web server. You will need to restart the PHP process pool. The command to accomplish that varies widely depending on the distro and your version of PHP. Check this page for your distro and see if you can find one that works.
For CLI invocations of PHP, the changes should take effect each time you run a new php script. You shouldn't have to restart anything for new commands to see the changes you made. If you have some long-running PHP script for some reason (very unusual) then you'd need to halt that process and re-invoke it after making your INI changes.
EDIT: I'd also point out that your INI file very clearly states you might get weird behavior on your CPANEL system. Make sure you follow its instructions:
; cPanel-generated PHP ini directives, do not edit
; Manual editing of this file may result in unexpected behavior.
; To make changes to this file, use the cPanel MultiPHP INI Editor (Home >> Software >> MultiPHP INI Editor)
; For more information, read our documentation (https://go.cpanel.net/EA4ModifyINI)

Can't increase MAMP php memory limit

I've been trying to increase the php memory_limit in MAMP (Mac OSX). The version of PHP I'm using is 5.4.1.0. I've read about creating a new template for MAMP Pro, but I'm using the standard version of MAMP.
I've tried all of the below, but nothing seems to have worked. Any help would be much appreciated.
Thank you for your time.
I've added the following to my site's htaccess file, which is read by the site and works (ExpressionEngine). But the master PHP limit is still not updating.
php_value memory_limit 128M
I've changed the following from 32M to 128M in the following file:
/Applications/MAMP/conf/php5.4.10
memory_limit = 128M ;
I then quit MAMP entirely and restarted it, but in MAMP phpInfo it still reads:
memory_limit 32M
Virtual Hosts
I am using Virtual Hosts to set my own URLs. I read somewhere that it may be necessary to increase the memory limit here. So I added this to the 'php_value memory_limit 128M':
/Applications/MAMP/conf/apache/extra/httpd-vhosts.conf
<VirtualHost *:80>
DocumentRoot /Applications/MAMP/htdocs
ServerName localhost
php_value memory_limit 128M
</VirtualHost>
and lower down in the same file in the relevant site's configuration:
<VirtualHost *:80>
DocumentRoot "/Users/Username/Dropbox/Dev/sitename.dev"
ServerName sitename.dev
php_value memory_limit 128M
</VirtualHost>
(By the way, I keep my MAMP folder (Dev) in Dropbox and it works fine)
php.ini
I also added a php.ini file with the following contents in both the root of my site directory and the root of my MAMP directory:
memory_limit = 128M
Managed to solve it ;-)
The correct one is:
/Applications/MAMP/bin/php/php[your_php_version]/conf/php.ini
find 'memory_limit' and increase the number:
memory_limit = [number]M
Thanks!
Make an phpinfo.php and put there the phpinfo(); in the output you can see the loaded configuration files and the values.
Edit the loaded php.ini file and set the memory limit. I think you have edited the wrong php.ini file or your application set the value over memory_limit.
I have been chasing this for a couple hours, trying to scrub through all my php.ini files trying to update the settings with a text editor and saving it. And every time I'd restart MAMP the settings would get changed back and the file would be overwritten. So here's how I did it where I finally didn't get overwritten by MAMP.
In MAMP, use the menu to get to version of PHP you are using. Mine is 7.3.1 at this time.
MAMP > File > Edit Template > PHP(php.ini) > 7.3.1
An editor window will open, then use the search bar to find your setting... memory_limit
Update your setting
Cmd + S then close the editor window OR just close the editor window and click "Save" when you are prompted
MAMP will then automatically re-start the servers with the new settings
In Mamp Pro and PHP version 7.2.8 ,you can find configuration file in this path:
/Applications/MAMP/bin/php/php7.2.8/conf/php.ini
But according to phpinfo(); My loaded configuration file is in different path! It is here:
/Library/Application Support/appsolute/MAMP PRO/conf/php7.2.8.ini
Also don't forget restart Mamp Pro.
Coming here after facing the same problem with PHP v.7.2. To fix this I needed to go to the path /usr/local/etc/php/7.2/conf.d/php-memory-limits.ini and change the following:
; Max memory per instance
memory_limit = 2048M
Anything else I tried would not change it.
Now I don't get this errors when trying to pull packages with composer in my projects (Fatal error: Allowed memory size of 536870912 bytes exhausted...)
I was able to set memory_limit with MAMP PRO 5.5 on MacOS here :
/Applications/MAMP/bin/php/php7.3.8/conf/php.ini
PHP mode is Individual PHP version for every host (CGI mode)

How to configure php.ini file

I am having a bit of trouble understanding how to set up the php.ini file on my website. I have included the line session.cookie_lifetime = 1800 as well as some others, but nothing has changed. When I go to my phpinfo.php pgae, none of the settings I have configured in the .ini file are not taken into effect. Can anyone help me with this? Thanks.
When you make changes in the php.ini file you have to restart the webserver or reloading the configuration files in most cases.
Because I have not enough reputation yet to write comments I assume you are using a LAMP environment. You can restart the webserver by typing in console:
service apache2 restart
or
/etc/init.d/apache2 restart
reload or force-reload instead of restart should also work for just reloading the configuration files, but with restart you're one the safe side.
Also make sure you're editing the correct php.ini file. You can find the right file by looking at the 'Loaded Configuration File' directive of phpinfo() output.
Add below lines in .htaccess file, it will increase the timeout to 30 minutes.
php_value session.cookie_lifetime 1800
php_value session.gc_maxlifetime 1800

Import file size limit in PHPMyAdmin

I have changed all the php.ini parameters I know:
upload_max_filesize, post_max_size.
Why am I still seeing 2MB?
Im using Zend Server CE, on a Ubuntu VirtualBox over a Windows 7 host.
Find the file called: php.ini on your server and follow below steps
With apache2 and php5 installed you need to make three changes in the php.ini file. First open the file for editing, e.g.:
sudo gedit /etc/php5/apache2/php.ini
OR
sudo gedit /etc/php/7.0/apache2/php.ini
Next, search for the post_max_size entry, and enter a larger number than the size of your database (15M in this case), for example:
post_max_size = 25M
Next edit the entry for memory_limit and give it a larger value than the one given to post_max_size.
Then ensure the value of upload_max_filesize is smaller than post_max_size.
The order from biggest to smallest should be:
memory_limit
post_max_size
upload_max_filesize
After saving the file, restart apache (e.g. sudo /etc/init.d/apache2 restart) and you are set.
Don't forget to Restart Apache Services for changes to be applied.
You probably didn't restart your server ;)
Or you modified the wrong php.ini.
Or you actually managed to do both ^^
Just change your php.ini(xampp/php/php.ini) file, it worked for me!
max_execution_time = 5000
max_input_time = 5000
memory_limit = 1000M
post_max_size = 750M
upload_max_filesize = 750M
And, don't forget to restart Apache Module from XAMPP Control Panel.
Increase phpMyAdmin upload / import size
By default you get a 2mb limit of upload / import size in phpmyadmin. That makes it odd and highly impossible to import larger files. You can increase the allowed upload size of phpmyadmin by editing your server’s php.ini configuration file. Usually in servers like CentOs it is located at /etc/php.ini.
Step 1: Go to php.ini and find the following and change their values to something more higher than your database size. (In this example i have used 20mb).
upload_max_filesize = 20M
post_max_size = 20M
Step2 : Restart your apache service for this new change to take effect. Usually the command to restart apache would be
service httpd restart (CentOs) / service apache2 restart (ubuntu)
You can also restart directly from their path like
/etc/init.d/apache2 restart or /etc/init.d/httpd restart
If you are in a shared hosting and do not have root access or access to your php.ini configuration file, then the other way is to create a .htaccess file in your application root and add the following line
php_value upload_max_filesize 10M
php_value post_max_size 10M
If you were still not able to increase it, please send me an email for more detailed assistance.
For uploading large files through PHPMyAdmin, follow these steps:
Step 1: Open your php.ini file.
Step 2: Upgrading Memory Limit:
memory_limit = 750M
Step 3: Upgrading Maximum size to post:
post_max_size = 750M
Step 4: Upgrading Maximum file-size to upload:
upload_max_filesize = 1000M
Step 5: Upgrading Maximum Execution Time:
max_execution_time = 5000
Step 6: Upgrading Maximum Input Time:
max_input_time = 3000
Step 7: Restart your xampp control panel.
Check your all 3:
upload_max_filesize
memory_limit
post_max_size
in the php.ini configuration file
* for those, who are using wamp #windows, you can follow these steps: *
Also it can be adapted to any phpmyadmin installation.
Find your config.inc.php file for PhpMyAdmin configuration (for wamp it's here: C:\wamp\apps\phpmyadminVERSION\config.inc.php
add this line at the end of the file BEFORE "?>":
$cfg['UploadDir'] = 'C:\wamp\sql';
save
create folder at
C:\wamp\sql
copy your huge sql file there.
Restart server.
Go to your phpmyadmin import tab and you'll see a list of files uploaded to c:\wamp\sql folder.
With WAMP, on Windows10, open
c:\wamp64\alias\phpmyadmin.conf
and change 128 by 256 at the end of these lines
php_admin_value upload_max_filesize 128M
php_admin_value post_max_size 128M
Restart WAMP
Open this file
edit these parameters:
memory_limit =128M
post_max_size = 64M
upload_max_filesize = 64M
This is how i did it:
Locate in the /etc/php5/apache2/php.ini
post_max_size = 8M
upload_max_filesize = 2M
Edit it as
post_max_size = 48M
upload_max_filesize = 42M
(Which is more then enough)
Restarted the apache:
sudo /etc/init.d/apache2 restart
None of the current answers will work for WHM / cPanel servers.
To increase the limit in WHM:
Navigate to Server Configuration > Tweak Settings
Choose the PHP tab
Update "cPanel PHP max POST size" & "cPanel PHP max upload size" (POST size should be bigger)
Ubuntu 20.04, 20.10, 22.04 and 22.10.
Well, with other distros as base Ubuntu as Xubuntu.
Edit : sudo nano /etc/php/7.4/apache2/php.ini
Search and modify : post_max_size = 120M and upload_max_filesize = 120M
Replace 120 with the value you need, e.g. 22M, etc.
Important, you have to change to the version of PHP that you have by default at that moment. Example with PHP 8.1: sudo nano /etc/php/8.1/apache2/php.ini
To check what version of PHP you have, just run php -v in your terminal.
I had the same problem.
My Solution:
go to /etc/phpmyadmin and edit apache.conf
in the <Directory>[...]</Directory> section you can add
php_value upload_max_filesize 10M
php_value post_max_size 10M
Solved the problem for me!
I found the problem and am post hete if anyone followed some blog post out there to create the sort of enviromment I have (win 7 host with ubuntu and zend server ce on virtual box).
The thing is that MySQL is running on Lighttpd, not under Apache. So I had to change the php.ini file under that webserver as well which is in the path:
/usr/local/zend/gui/lighttpd/etc/php-fcgi.ini
In the end, you were right about the files, of course, but I was wrong on what file I had to change :)
C:\xampp\php\php.ini in my case
or it could be C:\php\php.ini if the Apache / PHP / MySQL are stand alone
upload_max_filesize = 2M by default
so it can be changed as desired. And in my case
upload_max_filesize = 20M
post_max_size = 8M by default
it should be changed to post_max_size = 20M as well
memory_limit=128M is by default and it is not necessary to change to increase the max
2056kb or 2mb .sql file upload limit. But it only means that a script can consume up to 128 memory when you run apache and sql server , and if you change memory_limit=128M to higher and run any malfunctioned script then it may cause you trouble. So its up to you.
I had a problem with changing the upload size on my phpmyadmin and OS X 10.9.4 Mavericks.
At first I didn't know where the php.ini is so used locate
locate php.ini
which came back with
/private/etc/php.ini.default
/usr/local/etc/php/5.4/php.ini
I've tried editing /usr/local/etc/php/5.4/php.ini and then restart in the server put this didn't work.
I remembered that there is a better way to find out this file I'm looking for or and least where php is looking for php.ini.
<?php phpinfo() ?>
came back saying that it expects /etc/php.ini but I didn't have one there. The below is from the phpinfo():
Configuration File (php.ini) Path: /etc
It turns out that the first result in the locate command above is what I'm looking for.
At least in OS X 10.9.4 Mavericks (OS X is something new to me) /etc is actually a link, etc -> private/etc, and by the looks of it PHP assumes default values unless php.ini is actually present.
I copied /private/etc/php.ini.default
cp /private/etc/php.ini.default /private/etc/php.ini
Then checked the variables in the new /etc/php.ini as per Aditya Bhatt advice above and it worked.
In my case the values were:
memory_limit =128M
post_max_size = 64M
upload_max_filesize = 64M
Obviously, the apache service has to be restarted to see the changes.
php_value upload_max_filesize 100M
php_value post_max_size 100M
increse that size in php.ini then run command
sudo service apache2 restart
sudo service mysql restart
in xammp
restart all service
How to import huge amount of Data in Xampp
It’s the best solution to open new, clean database, and import the file in phpMyAdmin. Choose file from local folder and leave all settings as is. That should be it.
But if your file exceeded file size of 2MB (that is default value in xampp installation) than you need to tweak some out. Basically we will just increase the maximum upload file size.
Open your xampp install folder and go to php folder. With some text editor file (notepad++) open the file called php.ini (by type windows describe it as configuration settings) and edit the line (cca. 770, or press ctrl+f in notepad++ to find it):
post_max_size = 2M
instead 2M, put wanted maximum file size (16MB for example but not higher than 128M),
after that go to this line:
max_execution_time = 30
instead 30, increase execution time that’s in seconds (90 for example), also you need to change this line:
max_input_time = 60
instead 60, increase input time in seconds (120 for example)
and top of all you have to change this line:
upload_max_filesize = 2M
instead of 2M, increase to 16M for example.
Save the file, restart apache and mysql in xampp and try to upload again, if you follow correctly you should be able to import files through 16MB (example)
You could just use MySQL administrator app or MySQL workbench.
Lightweight apps and you can export or import your entire server however the size.
Am late to the party here but I hope it helps someone.
I had the same problem, My upload limit was 2 MB, I edited my php.ini, and I set it to 5 MB but still it was showing 2 MB even after restarting server. Than I compressed my .sql file to zip by keeping its name as xyz.sql.zip so it became 451 kb from 3.5 mb. Then I uploaded it again. It worked for me.
I found that increasing the upload and post limit in php.ini did not affect the limit in phpmyadmin. This is because my server has a separate setting for cpanel upload limit. If you have access to WHM, you probably have this.
To adjust:
login to your WHM panel: this is usually located at {your server ip}/whm and you will need your root login details here. If you don't have those, request them from your host.
once logged in, in the top left search bar, search for "tweak settings"
On the tweak setting pages, search for "cPanel PHP max upload size"
Adjust the number and save
No need to restart apache or anything, changes are instant. This process increased the value of max upload file size in phpmyadmin. You can check this by going to phpmyadmin and selecting your database, then clicking "import" at the top. Beside the file selector you will see the upload limit. My server default was 100.
In my case, I also had to add the line "FcgidMaxRequestLen 1073741824" (without the quotes) in /etc/apache2/mods-available/fcgid.conf. It's documented here http://forum.ispsystem.com/en/showthread.php?p=6611 . Since mod_fcgid 2.3.6, they changed the default for FcgidMaxRequestLen from 1GB to 128K (see https://svn.apache.org/repos/asf/httpd/mod_fcgid/trunk/CHANGES-FCGID )
do the following things
increase upload_max_file_size in php.ini
gzip your sql file
and then import the file
I was facing the same problem where increasing max size in php.ini has no effect on wordpress and tried many solutions like -:
Increase max size via functions.php
Increase max size via .htaccess file.
The one that worked for me is adding max size in .htaccess file.
It wasn't working with neither with php.ini file nor with functions.php file.
I just did add this code in .htaccess file and its done
php_value upload_max_filesize 64M
php_value post_max_size 64M
php_value max_execution_time 300
php_value max_input_time 300
NOTE: I did add above code in <IfModule> tag.
If php.ini file is not doing anything in changing size then try other 2 files for it and one of them will surely work for you.
READ THIS ARTICLE TO KNOW ABOUT ALL FILES IN WHICH YOU CAN INCREASE MAX SIZE
I think if your php version is above 5.5, let say it is 5.6, then your php.ini file is in following folder
/etc/php/5.6/apache2
so you have to apply your changes like post_max_size, upload_max_filesize and memory_limit there.
Hope it will help you.
I've tried all of the above and nothing worked for me: my phpmyadmin (on wamp) was still showing 128MiB (while I've needed to import DB which size was 212Mb)
so if U stucked as me you can import it with the help of commandline:
run bash (cmd, powershell or whatever terminal) from folder where your .sql file is located (or cd that path in terminal)
run mysql -u username -p database_name < file.sql where
username - is username for mysql server
database_name - is name of db you want import to
file.sql - is name of your sql file
👍😉
for me just worked like a charm after 2hours of trying to manipulate this through php.ini and other configurational files 🙈👌
Search for php.ini file
For xampp, you can get it # C:\xampp\php
Find the following 3 properties and set there value according to your need
memory_limit
post_max_size
upload_max_filesize
Restart Apache!
I am using Bitnami WAMP Stack 7.1.8-0 on my localhost. For me, the PHPMyAdmin maximum upload size limit was set to 80MiB as in the screenshot https://nimb.ws/fFxv7O. I managed to increase this size limit as explained below:
Go to the folder where you have installed the Bitname WAMP Stack, for me, it is "E:\Bitnami WAMP Stack”
Further inside, go to the path “apps\phpmyadmin\conf"
Open the file httpd-app.conf in your favorite text editor
Find the following two lines:
php_value upload_max_filesize 80M
php_value post_max_size 80M
(The 80M value at the end of these lines may be different for you)
Go ahead and change these values at the end of these two lines (80M in this case) according to your needs.
Restart WAMP server.
Now go to PHPMyAdmin and see, your upload size limit should be updated to whatever you set it to. That is it.
Note: (added July 2020)
I'm surprised nobody else has mentioned this ... changing php.ini should probably be your last resort when increasing file upload sizes to something as big as 64MB.
It may not matter greatly on development machines, but editing php.ini to globally increase max upload size could be a really bad idea on a server where you have several websites operating. MySQL imports to PHPMyAdmin are often large, but you don't want every Tom, Dick and Mary uploading 64MB files to another site on your server because you need to do it every now and again for your MySQL database.
I'd suggest a better solution is therefore (assuming you are using the standard Apache PHP module) to edit the specific virtual host configuration for PHPMyAdmin.
On Ubuntu Linux, this is found in /etc/apache2/conf-enabled/
phpmyadmin.conf. On WAMP/Windows/Whatever you'll need to look at the setup for your Apache configuration, but it will probably be in conf-enabled, conf.d, sites-enabled, or something like that. These are actually often just symlinks to the actual file which is located somewhere like /etc/phpmyadmin/apache.conf (again using Ubuntu as the example here).
Your apache.conf file will include lines something like this:
Alias /phpmyadmin /usr/share/phpmyadmin
<Directory /usr/share/phpmyadmin>
Options SymLinksIfOwnerMatch
DirectoryIndex index.php
# limit libapache2-mod-php to files and directories necessary by pma
<IfModule mod_php7.c>
php_admin_value upload_tmp_dir /var/lib/phpmyadmin/tmp
php_admin_value open_basedir /usr/share/phpmyadmin/:/etc/phpmyadmin/:/var/lib/phpmyadmin/:/usr/share/php/php-gettext/:/usr/share/php/php-php-gettext/:/usr/share/javascript/:/usr/share/php/tcpdf/:/usr/share/doc/phpmyadmin/:/usr/share/php/phpseclib/:/usr/share/php/PhpMyAdmin/:/usr/share/php/Symfony/:/usr/share/php/Twig/:/usr/share/php/Twig-Extensions/:/usr/share/php/ReCaptcha/:/usr/share/php/Psr/Container/:/usr/share/php/Psr/Cache/:/usr/share/php/Psr/Log/:/usr/share/php/Psr/SimpleCache/
</IfModule>
</Directory>
Immediately after <IfModule mod_php7.c> add these lines:
php_value post_max_size 64M
php_value upload_max_filesize 64M
Depending on your server config, you can probably achieve the same thing in an .htaccess file if you prefer. In which case you could just add the two lines by themselves (assuming you know for certain that PHP is enabled).
If you use fpm or fastcgi or something with or without Apache, the same more localized approach to controlling upload sizes can be achieved by using .user.ini files.
Ubuntu 20.04:
Changing php.ini files and restarting apache was not enough, I had to also do this:
sudo service php7.4-fpm restart
The first things to check (or ask your host provider to check) are the values of max_execution_time, upload_max_filesize, memory_limit and post_max_size in the php.ini configuration file. All of these three settings limit the maximum size of data that can be submitted and handled by PHP.
Please note that post_max_size needs to be larger than upload_max_filesize.

Categories