Skip to content

Instantly share code, notes, and snippets.

@fprochazka
Last active June 14, 2022 15:09
Show Gist options
  • Save fprochazka/8f2f233c6200937fd4c7de23d10b9148 to your computer and use it in GitHub Desktop.
Save fprochazka/8f2f233c6200937fd4c7de23d10b9148 to your computer and use it in GitHub Desktop.
Composer with different ini or with different PHP

Hacking Composer

When you wanna

  • use different version of PHP for Composer (or other CLI apps)
  • use different php.ini with Composer, because of for example slow XDebug (that you don't even need with production phar of Composer)

Usage

  • save composer.sh as /usr/local/bin/composer
  • save composer.php.ini as /usr/local/etc/composer.php.ini, or create your own ini
  • chmod +x /usr/local/bin/composer
  • profit

Mods

  • You can easily change the used PHP runtime by changing the php binnary to an absolute path
[php]
memory_limit = -1
max_execution_time = 0
date.timezone = "Europe/Prague"
realpath_cache_size = "4096K"
[opcache]
opcache.enable = 1
opcache.enable_cli = 1
opcache.memory_consumption = 256
opcache.interned_strings_buffer = 256
opcache.max_accelerated_files = 65407
opcache.validate_timestamps = false # keep in mind to flush the cache, once you update composer
opcache.save_comments = true
opcache.load_comments = true
opcache.max_file_size = 0
#!/bin/bash
php -n -c /usr/local/lib/composer.php.ini /usr/local/bin/composer.phar $@
@Doulla1
Copy link

Doulla1 commented Jun 14, 2022

Thanks !!

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