zmedia

Correcting errors Warning: Composer should be invoked via the CLI version of PHP, not the cgi-fcgi SAPI



1. Check the php that the cpanel account uses

[root@server user]# sudo -u user php -v

output

PHP 8.0.29 (cgi-fcgi) (built: Jun 13 2023 15:34:44)
Copyright (c) The PHP GroupZend Engine v4.0.29, Copyright (c) Zend Technologies


2. Call PHP CLI binary to cpanel account

[root@server user]# sudo -u user /opt/cpanel/ea-php80/root/usr/bin/php -v


3. Edit .bashrc

[root@server user]# nano /home/user/.bashrc

Copy this source

alias composer='/opt/cpanel/ea-php74/root/usr/bin/php /opt/cpanel/composer/bin/composer'

Run source to apply script

[root@server user]# source /home/user/.bashrc


4. Test composer in your Cpanel


Reference:
https://support.cpanel.net/hc/en-us/articles/4412178458135-How-to-resolve-the-Composer-should-be-invoked-via-the-CLI-version-of-PHP-not-the-cgi-fcgi-SAPI-error





Posting Komentar untuk "Correcting errors Warning: Composer should be invoked via the CLI version of PHP, not the cgi-fcgi SAPI"