0

I need to upload a file larger than 2MB. I have read this post

So I have modified the two lines on php.ini in this way:

; Maximum allowed size for uploaded files.
upload_max_filesize = 500M

; Must be greater than or equal to upload_max_filesize
post_max_size = 500M

Then I have restarted apache In truth, the correct name of the file that I have modified is php.ini.default in folder /etc/, but I think that the file is correct: in fact if i go on localhost/index.php to show php info, I see:

Configuration File (php.ini) Path:  /etc

However if in terminal; I digit

php -i

I get this:

upload_max_filesize => 2M => 2M
post_max_size => 8M => 8M

It seems like the php.ini file is not been saved, in fact I'm able to upload <=2M but not larger

(sorry for my english )

Lx2pwn
  • 313
  • 4
  • 11
  • 3
    have you restarted the server? and if yes check `phpinfo()` and check php.ini location in phpinfo for exact php.ini – Rahul Sep 19 '19 at 11:14
  • are you working on localhost? then restart your `apache` – PHP Ninja Sep 19 '19 at 11:14
  • You have to restart apache – Dieter Kräutl Sep 19 '19 at 11:16
  • @rahul sorry, I forgot to specify this. Hower yes, in in terminal I have digit `sudo apchectl restart` – Lx2pwn Sep 19 '19 at 11:16
  • @gulshan yes, I have restarted apache and yes, i'm working on localhost – Lx2pwn Sep 19 '19 at 11:17
  • `php -i | grep 'Loaded Configuration File'` - did you check this? Because `php.ini.default` seems to be the wrong file. – Tox Sep 19 '19 at 11:17
  • check phpinfo and check php.ini file location in there – Rahul Sep 19 '19 at 11:17
  • maximum post size and set time out as well ... best way to find where you config is changed or not .. go to phpMyadmin and click on import .. after chose file there is the maximum limit for file upload – Masih Ansari Sep 19 '19 at 11:18
  • `/etc/php/7.4/cli/php.ini` should be something like this – Rahul Sep 19 '19 at 11:18
  • save this file as `php.ini` – Andra Sep 19 '19 at 11:18
  • @Tox I checked and I get `Loaded Configuration File => (none)` . Maybe is this my error? – Lx2pwn Sep 19 '19 at 11:22
  • That seems odd, it should have some configuration loaded. You are on Linux, right? Is it your local machine or a remote server? – Tox Sep 19 '19 at 11:23
  • @Rahul i've already checked the location of file. It's in **/etc** directory. If I search `/etc/php/7.4/cli/php.ini` I don't find anything – Lx2pwn Sep 19 '19 at 12:35
  • @Andra if u refer to rename **php.ini.defualt** in **php.ini** I've already tried – Lx2pwn Sep 19 '19 at 12:37
  • @Tox I'm on localhost on a osx. if it can be of help, have followed this guide to install amps [link](https://medium.com/better-programming/install-apache-mysql-php-macos-mojave-10-14-b6b5c00b7de) – Lx2pwn Sep 19 '19 at 12:42
  • Did you try searching your `/etc/` directory for a `php.ini`? Because the path given by Rahul is for the CLI version of PHP 7.4 (which is not released as final yet, so most likely you have a lower version). – Tox Sep 19 '19 at 13:18
  • @Tox I have searched `/etc/` for a `php.ini`. In fact here is a `php.ini.default`. Also if I do `phpinfo()` in see this `Configuration File (php.ini) Path: /etc`. For this, I think that the file is correct. On terminal if I digiti `php --ini`, I get `Configuration File (php.ini) Path: /etc Loaded Configuration File: (none) Scan for additional .ini files in: (none) Additional .ini files parsed: (none)`. During the configuration of AMP, I have modified the http.conf file, in particular this line `LoadModule php7_module libexec/apache2/libphp7.so` – Lx2pwn Sep 19 '19 at 13:29
  • But renaming the `php.ini.default` to `php.ini` and then restarting `apache2` does not help? I don't know how your setup exactly works, I usually work with **nginx** and **PHP FPM** - in that setup I have to restart **PHP FPM** as well. A simple test could be to reboot your system, that will ensure everything is reloaded. If it works after the reboot, then there is another service that needs to be rebooted for the changes to become active. – Tox Sep 19 '19 at 13:36
  • @Tox finally it's work! simply I had to rename the `php.ini.defualt` in `php.ini`. Now if I do `php --ini`, I have `Configuration File (php.ini) Path: /etc Loaded Configuration File: /etc/php.ini` I already have done that when I answered @Andra, but probably I'm so stupid because I'm unable to rename a file – Lx2pwn Sep 19 '19 at 14:25
  • Shit happens, hehe. Good thing it now works :) – Tox Sep 19 '19 at 15:20

0 Answers0