cancel
Showing results for 
Search instead for 
Did you mean: 

Cron.php fatal error line 57

Cron.php fatal error line 57

I already created the Cron task but when i run it manually i get a php code error.

I leave the error here:

 

Task "php -q /var/www/vhosts/poleposition-pt.com/httpdocs/cron.php" completed with error in 3 seconds, output:

PHP Fatal error: Can't use method return value in write context in /var/www/vhosts/poleposition-pt.com/httpdocs/cron.php on line 57

 

In line 57 i have the following:

 

while (!empty($jobQueue->peek()) &&
strpos($jobQueue->peek()[\Magento\Update\Queue::KEY_JOB_NAME], 'setup:') === false
)

 

Can anyone give me a help to sort this out ?

Thanks in advance.

8 REPLIES

Re: Cron.php fatal error line 57

Hi @Alex_Rufus,

 

Let me ask you a few questions to understand your current situation:

 

1) Which version of Magento are you using (including the last number)?

2) Which version of PHP are you using?

3) Have you a custom cron running?

 

--
If you've found one of my answers useful, please give "Kudos" or "Accept as Solution"

Re: Cron.php fatal error line 57

Hi @Damian Culotta,

 

My Magento version is 2.1.0

My PHP is 5.6.27

Regarding the cron, I am using the one supplied with Magento.

 

Thanks for your reply and i look forward for your help on this.

 

Re: Cron.php fatal error line 57

@Alex_Rufus,

 

I can't find the cron.php on root directory.

Take a look: https://github.com/magento/magento2/tree/2.1

 

I can't know which file is that. Maybe you're /path/to/magento/update/cron.php ?

--
If you've found one of my answers useful, please give "Kudos" or "Accept as Solution"

Re: Cron.php fatal error line 57

Hi @Damian Culotta,

 

Yes, you are right.

I copied the cron file to the root folder to see if the result was different but it´s the same, same error and code line.

 

In fact the cron.php is in the Update folder.

 

Re: Cron.php fatal error line 57

I'm sorry but I've checked with Magento 2.0.9 and 2.1.2 and I can't reproduce the error.

Also, I've used PHP 5.6.28 and everything looks normal.

--
If you've found one of my answers useful, please give "Kudos" or "Accept as Solution"

Re: Cron.php fatal error line 57

I can supply you with screen shoots.

Version of PHP, Magento and error with line of code.

 

I really don´t understand.

To me it´s code related issue because:

 

PHP Fatal error: Can't use method return value in write context in /var/www/vhosts/poleposition-pt.com/httpdocs/update/cron.php on line 57

 

It states that the method return value can't be used in write context.

 

Editor.png

Magento version.pngphp version.pngerror.png

Re: Cron.php fatal error line 57

I am having the same issue.

 

Centos 7

Plesk Onyx

Magento 2.1

PHP 5.6.29

Re: Cron.php fatal error line 57

Hi Damian Culotta, Has this been resolved as I am facing the same issue on:

Centos VPN with PHP 7.1.9
With Magento 2.2.2


My Error:

Warning: htmlentities(): charset `ANSI_X3.4-1968' not supported, assuming utf-8 in /usr/local/cwpsrv/htdocs/resources/admin/addons/mail_explorer_addon.php on line 0 PHP Fatal error: Can't use method return value in write context in /home/UsernameXXX/public_html/update/cron.php on line 57

*UsernameXXX was changed