Skip to content

Instantly share code, notes, and snippets.

@x-magic
Created August 11, 2025 00:08
Show Gist options
  • Save x-magic/885195c6034d9462ec2f1d2d4eb21094 to your computer and use it in GitHub Desktop.
Save x-magic/885195c6034d9462ec2f1d2d4eb21094 to your computer and use it in GitHub Desktop.
Add Composer executable to cPanel/WHM > v130 globally
#!/bin/bash
# Download the latest version of composer.phar to /usr/local/bin/composer.phar
# Then put this file to /usr/local/bin/composer and allow execution
# Run Composer with cPanel PHP redirector and required parameters for CLI only
/usr/local/bin/php -d allow_url_fopen=1 -d zend.detect_unicode=0 /usr/local/bin/composer.phar $@
# For global self-update, you'll need the following for cronjob:
# /bin/bash -c 'COMPOSER_ALLOW_SUPERUSER=1 /usr/local/bin/php -d allow_url_fopen=1 -d zend.detect_unicode=0 /usr/local/bin/composer.phar self-update' > /dev/null 2>&1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment