Error - allow the upload_max to 6MB

Hi,

In my php.ini file I have modified the upload_max = 6MB. But despite that on the pre-configuration page, it tells me an error, that I have to allow the upload_max to 6MB.
How can I fix it?

Thanks.

A couple of ideas:

  1. Increase your upload max to 10MB (This is because some warnings aren’t always updated in line with size increases, plus the perpetual problem with 1024 v 1000, and just because the error says 6MB, is the actual size 6.1MB and the value has been truncated? :thinking:
  2. Bear in mind that there are often multiple php.ini on any system. One for the CLI, and one for the web server, and potentially others, which brings me to one of the most important issues in order to maximise the support capabilities in the forum:

A good bug/problem statement. See:
https://www.chiark.greenend.org.uk/~sgtatham/bugs.html

In particular, always provide the EXACT error message.
Versions that you are working with - Is this a known bug? - If not, then it may need reporting to save others the time and frustration.
Operating system is really useful. Files/permissions work differently between say Windows and Linux
Configuration where appropriate Apache/Nginx, Use of PHP-FPM all have different issues relating to file uploads inc timeouts, different php.ini associated with the active thread carrying out the upload etc

Hopefully the above gives you an idea about where to look for your problem.

Hi,

I have modified my php.ini to 10 MB. But the error is still there, and I only have a php.ini file.
Error message:
Warning: Your PHP configuration needs to be changed to allow uploading of files of at least 6 MB.

My php.ini file:
erreur 6mb

Thanks for your help.

There’s another php.ini somewhere in your setup. One is for command line…which I’m guessing is the one that you’ve changed. There is another somewhere in your nginx/ xampp / apache2/ httpd etc config files. That’s the one that you need to change.

Hello,

I did a search and found 2 php.ini files
But even if I modify them both, it doesn’t change anything

Configuration: Centos 7.9

You MUST restart apache2 after making the change in order for the web server changes to take place:

sudo systemctl restart httpd

Also with CentOS 7.9, are you using php-fpm? in which case there’s potentially 3 php.ini files on your system :grin:

here is the search I did for the php.ini files

recherche fichierini

I restarted the services and still nothing

:persevere:

Try:

  1. Check your php.ini page - It gives you:
    -Configuration File(php.ini) Path
    -Loaded configuration file
    -Additional ini files parsed

  2. Searching the /etc/ directory for all instances of the php directive
    grep -inr upload_max_filesize /etc/

For me I get

/etc/php.ini:825:upload_max_filesize = 7M

(This checks that there isn’t anything silly overwriting the value in your etc directory.

  1. Using the grep -inr command on a file will locate whether the directive has been inserted more than once in a given file.

Here is the answer of the order

grep reponse

I have to delete the php.ini.swo file ?

You shouldn’t HAVE to delete the swap file, but:

rm /etc/.php.ini.swo

should do it in order to tidy things up.
After restarting apache, doe your phpinfo() page still show only 2 MB?

What about that /applis/php-7.4.19/lib/php.ini file?

It always displays 2M on the phpinfo() page.

I have modified the 2 php.ini files
/applis/php-7.4.19/lib/php.ini -> I have indicated 40M
and for
/etc/php.ini -> I indicated 30M

and to restart my services I use this command :
systemctl restart httpd-2.4.48.service
is this the right command ?

Try:
systemctl stop httpd
followed by
systemctl start httpd

I suspect that restart might merely reads in the .conf files ?

suggests that this might be a glitch and recommends restarting the whole machine! Seems drastic!

using this command, it shows the php.ini present at /applis/php-7.4.19/lib

grep phpini (1)

and when I try the two commands systemctl stop httpd followed by systemctl start httpd.
I had this problem
“Job for httpd.service failed because the control process exited with error code. See “systemctl status httpd.service” and “journalctl -xe” for details.”

I restarted the server and it still doesn’t work.
And according to the phpinfo the file to modify is /applis/php-7.4.19/lib/php.ini

If you’re getting the information from the command line, then the php.ini is the one associated with the command line.

If you’re able to view phpinfo() in your browser then the path declared there is the one that you want.

This implies that there is something wrong with your httpd configuration. Can we get the output from:

phpini phpinfo
According to the phpinfo this is the one. So this is the one I have to modify ?

The problem would not come from the fact that the “loaded configuration file” is (none) ?

My understanding:

/applis/php-7.4.19/lib/php.ini exists based on information provided so far. However, from your phpinfo, this file is not loaded. Potential issues are:

  1. The path is unusual for a centOS system, so there may be issues with permissions for your httpd to access it.
  2. The path is unusual, so potental for selinux preventing the file from being loaded.
  3. You’ve asked for 40M to be allocated for uploads. This is a fairly extreme value, but when apache2 installs a module, this memory is allocated from the memory allocated to the httpd. Therefore reduce the value down to 10M (This is more than ample)

In order to test 1 and 2 you could try:
runuser -u apache – cat /applis/php-7.4.19/lib/php.ini
(as root). This will attempt to read the php.ini file as the user apache. (Assuming that your httpd is running as apache. If you’ve done a load of upgrades, then it could be www-data - use “lsof -i | more” or similar to confirm identity)

The problem is also going to be reported in the “journalctl -xe” output, and will also likely to be in the following log files:

/var/log/httpd/error.log (or variation on this in that folder)
and
/var/log/audit/audit.log (if this turns out to be a selinux issue)

Selinux issues can be confirmed by TEMPORARILY disabling selinux. Once confirmed, fix the problem and re-enable!

Hello,

I found the source of the problem. It was the php that was badly compiled. The php has been recompiled and I can modify the php.ini again.

Thank you for your time and help. anothermouse