4

I'm trying to deploy my Symfony 2 application on debian server. The website works pretty well. However I meet this issue for the upload picture...

I try to upload a picture and my RestFul API returns this error :

The file "file.JPG" exceeds your upload_max_filesize ini directive (limit is 2048 kb). (500 Internal Server Error)

I checked on internet how to resolve this problem. Apparently, I need to change the value of

upload_max_filesize = 2M

I changed the value for 20M. I've also changed the post_max_size. My new configuration is :

upload_max_filesize = 20M
post_max_size = 20M

After updating, I did relaunch the server with this command :

/etc/init.d/apache2 reload

It doesn't change anything. I still have the same error :/ I'm root, so it's not a problem of permissions. With php info, I located the php.ini, so I guess that I change the right file.

I don't see any other solutions ...

manonthemoon
  • 2,611
  • 8
  • 26
  • 40
  • Consider changing `post_max_size` as described here: http://stackoverflow.com/questions/6135427/increasing-the-maximum-post-size – Jovan Perovic Feb 07 '14 at 19:56
  • I tried this too ... I have `post_max_size = 20M` ... The problem is still here :/ – manonthemoon Feb 07 '14 at 20:11
  • 2
    Using PHP-FPM ? If yes - `/etc/init.d/php-fpm restart`. Tried `apache2 restart` instead of `reload` ? Sure you're editing the right `php.ini` ? the php-CLI might have a different one -> `php -i | grep ini` can point to a different ini-file than `phpinfo();` ! Double-check `phpinfo()`'s path to the `php.ini` or just click on the PHP version in the symfony debug toolbar .. – Nicolai Fröhlich Feb 07 '14 at 21:12
  • No... I don't have Php-fpm. When I go inside init.d directory, there is not php-fpm... I tried /etc/init.d restart, and relaunch, the result is the same :/ ... When i'm editing php.ini, i'm sure to edit the right file. I edit the file with the path given by phpinfo() ... On the server, i did : php -i | grep "Configuration File" . – manonthemoon Feb 07 '14 at 21:25
  • I meant that the path was given by the command php -i ... I haven't used phpinfo(). Now, I've just tried what you recommanded, I made a php file and I called the function phpinfo(), the path for the loaded configuration file is different than the path given by the command php -i ... Very weird. Thanks for your help. I've updated the right php.ini. Now it works very well ! – manonthemoon Feb 07 '14 at 21:34

1 Answers1

4

Thanks to the help of @nifr, I followed his instruction and I tried to get the php info with a php file by calling the method phpinfo(). The path of Loaded Configuration file given by this call is different of the path given by the command php -i | grep "Configuration File".

If you want to make some changes for php, be sure to change the right php.ini. To be sure of the location of this file, just use the function phpinfo(). It's the best way

manonthemoon
  • 2,611
  • 8
  • 26
  • 40