Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Magento shell script is NOT working where PHP environment CGI/FCGI
 
nigital
Jr. Member
 
Total Posts:  26
Joined:  2009-11-13
Germany
 

Hi Magento team & community,
I hope I am getting some attention here, and maybe I can provide a solution to those who a experiencing this issue as well.

When your hosting environment’s PHP binary has not been compiled as “CLI” (but e.g. as CGI/FCGI instead), the mage shell script (which executes downloader/mage.php) is not usable. This is due to a a check in mage.php, testing for

defined('STDIN') && defined('STDOUT') && defined('STDERR')

In non-CLI environments theses global constants are available, and execution stops without any further notice (!).
I posted this on the bug tracking system here:
http://www.magentocommerce.com/bug-tracking/issue/?issue=12306
and - after receiving no reply for two months (!) - again here:
http://www.magentocommerce.com/bug-tracking/issue?issue=12681
also providing a solution in form of a patch file (!).

The suggested modification is as follows:

if ((defined('STDIN') && defined('STDOUT') && defined('STDERR'))
|| (
substr(PHP_SAPI03) === 'cgi' && (defined('SHELL') || defined('TERM')))) {
__cli_Mage_Connect
::instance()->init($argv)->run();
}
else die('Error: mage.php must be run from the command line.');

Within another three weeks still no reply. This is kind of miserable.

So I wonder, if I anyone else came accross or can reproduce this? Or if this only occurred due to some rare circumstances within our environment.
Maybe my solution creates a security vulnerability? Let’s discuss here.

File Attachments
mage.patch.php  (File Size: 1KB - Downloads: 29)
 
Magento Community Magento Community
Magento Community
Magento Community
 
nigital
Jr. Member
 
Total Posts:  26
Joined:  2009-11-13
Germany
 

Is really nobody using the Magento shell script?

 
Magento Community Magento Community
Magento Community
Magento Community
 
nigital
Jr. Member
 
Total Posts:  26
Joined:  2009-11-13
Germany
 

I appreciate any kind of feedback.

 
Magento Community Magento Community
Magento Community
Magento Community
 
nigital
Jr. Member
 
Total Posts:  26
Joined:  2009-11-13
Germany
 

Nobody? Kind of frustrating.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top