44

I want change the limit of PHP upload file's size

And this is some information of the output my phpinfo:

Configuration File (php.ini) Path    /etc/php5/apache2
Loaded Configuration File    /etc/php5/apache2/php.ini

And this is the content of my php.ini file:

upload_max_filesize = 50M
post_max_size = 50M
memory_limit = 128M

Then I restart Apache 2, but the phpinfo shown is still:

upload_max_filesize    2M
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
tinybai
  • 916
  • 1
  • 6
  • 17

8 Answers8

22

I have solved my question.

There is a syntax error in php.ini in line 109, so the next all syntax does not execute.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
tinybai
  • 916
  • 1
  • 6
  • 17
  • What do you mean by *"the next all syntax does not execute"* (seem incomprehensible)? Please respond by [editing (changing) your answer](https://stackoverflow.com/posts/11673121/edit), not here in comments (***without*** "Edit:", "Update:", or similar - the answer should appear as if it was written today). – Peter Mortensen Nov 04 '21 at 22:42
11

There is a good chance you didn't have permissions to modify the php.ini file. If you just browse to it via a normal folder window and click it Gedit (or whatever your default text editor is) won't be able to open it with write permissions.

You should be able to get away by sudo nano /etc/php5/apache2/php.ini (then your password at the prompt) and then changing the variables. Then be sure to write out (Ctrl + O) or make sure you confirm the save on exit.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Fluffeh
  • 33,228
  • 16
  • 67
  • 80
10

For anyone wondering why the php.ini modification is not applied even after all directives are fine and restarting the apache on ubuntu, try restarting apache with sudo

sudo service apache2 restart
Rystian
  • 101
  • 1
  • 3
5

I have the same problem and this solve it I have foound php.ini inside folder /etc/php5/cli/php.ini I make changes to it

and restart apache sudo apache2ctl restart

I have already change /etc/php5/apache2/php.ini and restart apache by using sudo service apache2 restart but symfony doesn't see changes

I write it , it may help anyone

user23946
  • 47
  • 1
  • 3
4

Here is how I solved this issue on Ubuntu after about three hours of debugging (PHP 7)

Steps

  1. Run phpinfo() function and observe where the loaded PHP configuration file (php.ini) is

    Enter image description here

  2. 'cd' into that directory and update it to the new values

  3. Reboot your server

  4. It works!

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Ewomazino Ukah
  • 2,286
  • 4
  • 24
  • 40
1

I suspect a lot of these problems are being experienced because FastCGI Process Manager (php-fpm) is now used by default on a lot of new Apache installations. After making the changes, you need to restart the fast CGI daemon, not httpd.

See When php.ini appears to be ignored

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
0

I use over ubuntu 14.10 the command:

sudo /etc/init.d/apache2 restart

Doberon
  • 611
  • 9
  • 19
0

I too had the same problem but then found that root permission is needed to edit php.ini file so just opened the terminal and wrote the following

gksudo gedit /etc/php5/apache2/php.ini

and it perfectly worked!!

Debs
  • 331
  • 1
  • 3
  • 22