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

php memory limit not changing #1281

Open
Corvalan opened this issue Apr 15, 2018 · 9 comments
Open

php memory limit not changing #1281

Corvalan opened this issue Apr 15, 2018 · 9 comments

Comments

@Corvalan
Copy link

I need to increase the php memory limit because composer complains it needs more.

in /opt/etc/fpm/fpm-pool-common.conf I have set php_admin_value[memory_limit] to 2G

then i reloaded service php56-fpm reload which is the only fpm service running as far as i see. I even rebooted the server.

Still the php memory limit shows as 1028M
when i use php -r "echo ini_get('memory_limit').PHP_EOL;"

What could i have missed here?

@Corvalan
Copy link
Author

It appears that the php memory setting used in my boa system is /opt/etc/php56/lib/php.ini

fpm-pool-common.conf skips that file?

@omega8cc
Copy link
Owner

BOA is using separate settings and INI files for PHP CLI and FPM. Furthermore, every Octopus instance has these limits enforced via account level PHP ini file in /home/o1.web/.drush/. The same is valid for your SFTP/SSH account o1.ftp. They are auto-configured depending on the RAM available.

But you mentioned composer, so you are probably looking to increase CLI limits only?

Please be more specific and confirm which exactly account you are using where you wish to change these limits, so we could confirm where you can adjust them.

@Corvalan
Copy link
Author

Corvalan commented Apr 27, 2018

I´m using account o1.ftp with composer commands. Composer is the only reason why I am forced to increase php memory limit. My server uses 16GB RAM.

@omega8cc
Copy link
Owner

omega8cc commented Jul 8, 2018

For global system PHP-CLI you should edit the correct PHP version file located in one of these paths:

/opt/php56/etc/php56.ini
/opt/php70/etc/php70.ini

For o1.ftp the file to edit is /home/o1.ftp/.drush/php.ini

Note that you will need to make it editable first (as root) with command:

chattr -i -R /home/o1.ftp/.drush

You may need to edit all these INI files, since composer may invoke global PHP default versions and not your Aegir PHP-CLI version.

@gandhiano
Copy link

I am facing a similar problem. I attempted to increase the memory both at the global level (/opt/php56/etc/php56.ini), as well as for the o1 user I'm running PHP from (/data/disk/o1/.drush/php.ini) but there is no change in the assigned memory:

$ php -r "echo ini_get('memory_limit').PHP_EOL;"
512M

@gandhiano
Copy link

I found now the right place to do this setting for composer to work. It is under /opt/php56/lib/php.ini (of course in my case for PHP version number 5.6, replace with the appropriate version in use).

This should probably be added to the documentation, as I guess anyone using composer to update drupal 8 sites on a host with a limited amount of RAM will face this problem.

@yaazkal
Copy link
Contributor

yaazkal commented Nov 2, 2018

Hi, not sure why composer is requiring that on a production server, maybe you are doing composer update or similar task on the server? maybe also developing directly on the server? (Nothing wrong if that is a dev server).

But, It is always recommended and a better practice to run something like composer update, composer require, composer remove or any other resource consuming command on a local/dev machine, then push the composer.lock file to the server and run composer install --no-dev in production (--no-dev because we will not need developtment dependencies on production, right?).

I hope that helps both of you to have a better workflow and a healthy server.

@lexsoft00
Copy link

You could add a file composer_nolimit and add this command to it. Make it an executable and whitelisted to be accessible by o1.ftp.
php -d memory_limit=-1 /usr/local/bin/composer

Then instead of calling composer you can call composer_nolimit, or you can increase the limit there.

Hope this helps.

@lexsoft00
Copy link

Hi @Corvalan

I've written a solution here:
#1308 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants