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

Remove hard coded ini_set('memory_limit') #5583

Open
haapakanni opened this issue Jan 14, 2020 · 1 comment · May be fixed by #5669
Open

Remove hard coded ini_set('memory_limit') #5583

haapakanni opened this issue Jan 14, 2020 · 1 comment · May be fixed by #5669
Assignees
Labels

Comments

@haapakanni
Copy link

@haapakanni haapakanni commented Jan 14, 2020

Bug Report

Expected behavior

Good programming practise is not to use hard coded configuration values to override global, enviromental, system nor project basis settings.

Actual behavior

Hard coded memory_limit ini setting override in vendor component is causing hours of extra work for programmers and system administrators as the common approach to adjust the ini setting via php.ini, apache.conf, .htaccess or enviromental variables are not taking affect. In worst case scenario all of the possible approaches are tested causing multiple restarts of services starting from php-fpm instances, apache servers and pdfreactor jetty webservices before the bad practise from the source code gets located.

Steps to reproduce

Please do render for example gigabyte size of pdf-file with pimcore and pdfreactor to reproduce (in press and print production the gigabyte is small document as printing quality requirements are high and there for system administrators will end up configuring php.ini directives).

Code example

https://github.com/pimcore/pimcore/blob/master/bundles/CoreBundle/Command/Web2PrintPdfCreationCommand.php (execute-method)

// remove following line from the source
ini_set('memory_limit', '2048M');

As otherwise sysadmin nor programmer cannot overcome the following /var/logs/php.log error:

PHP Fatal error:  Allowed memory size of 2147483648 bytes exhausted

Current approach will also "hide" system requirement.

@brusch

This comment has been minimized.

Copy link
Member

@brusch brusch commented Jan 20, 2020

We should make this value configurable via Symfony config.
I think a good place would be somewhere there:

pimcore:
  documents: 
    web_to_print: 
      pdf_creation_php_memory_limit: VALUE
@brusch brusch added the Task label Jan 20, 2020
@brusch brusch added this to To do in #77 | 20/01/2020 - 31/01/2020 via automation Jan 20, 2020
dvesh3 added a commit that referenced this issue Jan 24, 2020
dvesh3 added a commit that referenced this issue Jan 24, 2020
@dvesh3 dvesh3 moved this from To do to In progress in #77 | 20/01/2020 - 31/01/2020 Jan 24, 2020
dvesh3 added a commit that referenced this issue Jan 24, 2020
dvesh3 added a commit that referenced this issue Jan 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
3 participants
You can’t perform that action at this time.