Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Respect user settings in php.ini if they are big enough #32216

Merged
merged 3 commits into from
May 17, 2022

Conversation

mickenordin
Copy link
Contributor

@mickenordin mickenordin commented Apr 29, 2022

In the admin guide:

Fix #32209

it is mentioned that you can tweek:

  • max_input_time
  • max_execution_time

in order to enable larger file uploads. However, the current codebase
will hard code these values to one hour, no matter what the user sets in
php.ini.

This patch will allow the user to set these settings in php.ini and they
will be respected, if and only if, they are set to something bigger than
3600 seconds.

@mickenordin
Copy link
Contributor Author

This fixes #32209

@szaimen
Copy link
Contributor

szaimen commented Apr 29, 2022

Thanks for your PR! can you please solve DCO (see https://github.com/nextcloud/server/pull/32216/checks?check_run_id=6223623697)? Thank you!

@szaimen szaimen added this to the Nextcloud 25 milestone Apr 29, 2022
@szaimen szaimen added bug 3. to review Waiting for reviews labels Apr 29, 2022
@szaimen szaimen requested review from CarlSchwan, Pytal, a team, ArtificialOwl and blizzz and removed request for a team April 29, 2022 11:34
In the admin guide:
* https://docs.nextcloud.com/server/latest/admin_manual/configuration_files/big_file_upload_configuration.html

it is mentioned that you can tweek:
* max_input_time
* max_execution_time

in order to enable larger file uploads. However, the current codebase
will hard code these values to one hour, no matter what the user sets in
php.ini.

This patch will allow the user to set these settings in php.ini and they
will be respected, if and only if, they are set to something bigger than
3600 seconds.

Signed-off-by: Micke Nordin <kano@sunet.se>
@mickenordin
Copy link
Contributor Author

Thanks for your PR! can you please solve DCO (see https://github.com/nextcloud/server/pull/32216/checks?check_run_id=6223623697)? Thank you!

Sure, fixed.

lib/base.php Outdated Show resolved Hide resolved
Co-authored-by: Louis <6653109+artonge@users.noreply.github.com>
Signed-off-by: Micke Nordin <kano@sunet.se>
@kesselb
Copy link
Contributor

kesselb commented May 1, 2022

Thanks for sending a pull request 👍

The above code should work and allow an administrator to pick a higher value.

I think the actual issue here is that we configure max_execution_time and max_input_time at all. That code should go and we introduce a setup check to inform the administrator that an update for php.ini / user.ini / .htaccess is required to configure good limits. This auto configuration approach might be nice but it's always a pain if one needs a higher limit. My take here is that Nextcloud should not try to auto configure the environment but tell the administrator what's necessary. Less magic => less pain ;)

Also keep in mind that almost every request is executing this code. It's already bad to have the ini_set calls (with suppress operator) here. If we merge this patch we check on each time if there is a higher limit and if not run the ini_set call. I don't think that removing those calls will improve the performance yet it's still bad.

@CarlSchwan
Copy link
Member

Thanks for sending a pull request +1

The above code should work and allow an administrator to pick a higher value.

I think the actual issue here is that we configure max_execution_time and max_input_time at all. That code should go and we introduce a setup check to inform the administrator that an update for php.ini / user.ini / .htaccess is required to configure good limits. This auto configuration approach might be nice but it's always a pain if one needs a higher limit. My take here is that Nextcloud should not try to auto configure the environment but tell the administrator what's necessary. Less magic => less pain ;)

Also keep in mind that almost every request is executing this code. It's already bad to have the ini_set calls (with suppress operator) here. If we merge this patch we check on each time if there is a higher limit and if not run the ini_set call. I don't think that removing those calls will improve the performance yet it's still bad.

For shared hosting providers, it's often not possible to modify the ini files, this is probably the reason why this is done like this currently.

@solracsf
Copy link
Member

solracsf commented May 2, 2022

For shared hosting providers, it's often not possible to modify the ini files, this is probably the reason why this is done like this currently.

For shared hosting, most of the time, both are disabled (ini files and ini_set())

@mickenordin
Copy link
Contributor Author

Thanks for sending a pull request 👍

The above code should work and allow an administrator to pick a higher value.

I think the actual issue here is that we configure max_execution_time and max_input_time at all. That code should go and we introduce a setup check to inform the administrator that an update for php.ini / user.ini / .htaccess is required to configure good limits. This auto configuration approach might be nice but it's always a pain if one needs a higher limit. My take here is that Nextcloud should not try to auto configure the environment but tell the administrator what's necessary. Less magic => less pain ;)

Also keep in mind that almost every request is executing this code. It's already bad to have the ini_set calls (with suppress operator) here. If we merge this patch we check on each time if there is a higher limit and if not run the ini_set call. I don't think that removing those calls will improve the performance yet it's still bad.

I am not married to either solution, I just want to be able to change the setting and not have it hard coded, which I think is the worst solution of them all.

This patch is proposed because it is backwards compatible with the old solution. I don't know if removing the hard coded value altogether will break stuff for a lot of people on shared hosting or for people who did not have to think about this untill now. I also don't think there is a lot of performance penalty with doing it this way so it shouldn't be a problem, but if you guys would rather remove the hard coded value that is fine too for me. :)

@solracsf
Copy link
Member

solracsf commented May 2, 2022

Sure, this is a "problem" of all ini_set() calls at lib/base.php ;)

lib/base.php Outdated Show resolved Hide resolved
lib/base.php Outdated Show resolved Hide resolved
lib/base.php Outdated Show resolved Hide resolved
Signed-off-by: Micke Nordin <kano@sunet.se>
@mickenordin mickenordin requested a review from artonge May 16, 2022 08:17
@artonge artonge merged commit 8ed92ad into nextcloud:master May 17, 2022
@welcome
Copy link

welcome bot commented May 17, 2022

Thanks for your first pull request and welcome to the community! Feel free to keep them coming! If you are looking for issues to tackle then have a look at this selection: https://github.com/nextcloud/server/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22

@szaimen
Copy link
Contributor

szaimen commented Aug 22, 2022

/backport to stable24

@szaimen
Copy link
Contributor

szaimen commented Aug 22, 2022

/backport to stable23

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Imposible to set max_execution_time and max_input_time in php.ini
8 participants