<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>php-cli on Tutes Club</title><link>https://tutes.in/tag/php-cli/</link><description>Recent content in php-cli on Tutes Club</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Tue, 12 Feb 2019 18:01:40 +0000</lastBuildDate><atom:link href="https://tutes.in/tag/php-cli/index.xml" rel="self" type="application/rss+xml"/><item><title>How to fix Composer should be invoked via the CLI version of PHP, not the cgi-fcgi SAPI error in SSH?</title><link>https://tutes.in/how-to-fix-composer-should-be-invoked-via-the-cli-version-of-php-not-the-cgi-fcgi-sapi-error-in-ssh/</link><pubDate>Tue, 12 Feb 2019 17:58:38 +0000</pubDate><guid>https://tutes.in/how-to-fix-composer-should-be-invoked-via-the-cli-version-of-php-not-the-cgi-fcgi-sapi-error-in-ssh/</guid><description>&lt;p&gt;Put this in your bash profile and run &lt;strong&gt;source ~/.bashrc&lt;/strong&gt;&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;alias&lt;/span&gt; &lt;span class="nv"&gt;composer&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;/opt/cpanel/ea-php71/root/usr/bin/php /opt/cpanel/composer/bin/composer&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;hr&gt;
&lt;p&gt;As Composer is now available via WHM you can use this to find it:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;which composer
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This returned path “&lt;strong&gt;/opt/cpanel/composer/bin/composer&lt;/strong&gt;” for me. If this returns nothing then disregard the rest of this answer, as Composer is not available to you at system level.&lt;/p&gt;
&lt;p&gt;You can now use &lt;code&gt;php-cli&lt;/code&gt; to call this with Composer’s absolute path:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;php-cli /opt/cpanel/composer/bin/composer install
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;php-cli /opt/cpanel/composer/bin/composer update
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;php-cli /opt/cpanel/composer/bin/composer require whatever/example
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;You may however need to alias &lt;code&gt;php-cli&lt;/code&gt; if your system claims this isn’t found. It very much depends how PHP has been deployed on the WHM server. &lt;a href="https://tutes.in/fix-magento-2-php-cli-error-on-cpanel-or-other-hostings/"&gt;Learn how to fix PHP CLI error&lt;/a&gt;. You can do this by adding a user alias to the end of your “&lt;strong&gt;.bashrc&lt;/strong&gt;” or “&lt;strong&gt;.bash_profile&lt;/strong&gt;” file as follows:&lt;/p&gt;</description></item><item><title>Fix Magento 2 – php cli error on cpanel or other hostings</title><link>https://tutes.in/fix-magento-2-php-cli-error-on-cpanel-or-other-hostings/</link><pubDate>Mon, 10 Sep 2018 22:10:59 +0000</pubDate><guid>https://tutes.in/fix-magento-2-php-cli-error-on-cpanel-or-other-hostings/</guid><description>&lt;h2 id="the-problem"&gt;The problem:&lt;/h2&gt;
&lt;p&gt;On a fresh install of Magento2 on cpanel based hosting, you receive the following error while running any command on SSH&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="o"&gt;[&lt;/span&gt;eee@e1 www&lt;span class="o"&gt;]&lt;/span&gt;$ php bin/magento cache:clean
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;X-Powered-By: PHP/7.0.31
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Content-type: text/html&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nv"&gt;charset&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;UTF-8
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;bin/magento must be run as a CLI application
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="o"&gt;[&lt;/span&gt;eee@e1 www&lt;span class="o"&gt;]&lt;/span&gt;$ php bin/magento setup:upgrade
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;X-Powered-By: PHP/7.0.31
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Content-type: text/html&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nv"&gt;charset&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;UTF-8
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;bin/magento must be run as a CLI application
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="the-solution"&gt;The Solution:&lt;/h2&gt;
&lt;p&gt;You have to point php to correct binary;&lt;br&gt;
Use the following code in order:&lt;br&gt;
First, open the file which can alter the runtime variables like &lt;code&gt;.bash_profile&lt;/code&gt; or &lt;code&gt;.bashrc&lt;/code&gt;&lt;/p&gt;</description></item></channel></rss>