I had a problem when publishing project via composer as cPanel user. When trying to execute composer via cpanel user with ssh access, composer returned nothing. This was on CloudLinux with alt-php (PHP Selector) and cPanel.
In documentation is stated that for composer to work, we need PHP library’s Phar, Iconv, Mbstring. This can be done easily with PHP Selector in your user interface. Documentation also says that we need to have enabled allow_url_fopen which is also specified as possible security issue so it shouldnt be enabled globally. And lastly, if you use suhosin, which you should, you have to whitelist Phar. You should do all of this so that is only affecting php.ini for specific user and not globally. Also, you’ll want to increase memory_limit as composer needs it. In my case, I temporary increase it to 1G. First, enable all necessary php library’s through PHP Selector in you cpanel control panel. Then follow steps bellow.
Login in users CageFS like this:
root@server [~]# cagefsctl -e
Then go to your alt-php configuration directory:
root@cpanel [~]# cd /etc/cl.php.d/alt-php<desired version>/
Inside of this directory you should see file alt_php.ini, open it and add this to end of the file:
;>=== Start of PHP Selector Custom Options === memory_limit=1G suhosin.executor.include.whitelist=phar ;<=== End of PHP Selector Custom Options =====
Save this settings and exit user CageFS. You don’t need to restart apache. Then SSH with your cpanel user and try to run composer.
Composer should now work with your cPanel user:
thisisme@server [/]# composer --version Composer version 1.6.2 2018-01-05