Jump to content
  • 0

Cron error. Unexpected '[' in config/services.php


Question

Posted

I'm having a problem when trying to run the cron. I'm using Plesk Onyx. Here is the command I'm running:

  Quote

php /var/www/vhosts/aphiso.io/httpdocs/abase/index.php cron

I've tried this as well with the same results.

/usr/bin/php /var/www/vhosts/aphiso.io/httpdocs/abase/index.php cron

Expand  

Here is the full error it's kicking back when trying to run the cron:

  Quote

Task "/usr/bin/php /var/www/vhosts/aphiso.io/httpdocs/abase/index.php cron" completed with error in 0 seconds, output:

PHP Parse error: syntax error, unexpected '[' in /var/www/vhosts/aphiso.io/httpdocs/abase/config/services.php on line 3

Expand  

And here is the content of the config/service.php file:

<?php

return [
    'Blesta\\Core\\ServiceProviders\\MinphpBridge',
    'Blesta\\Core\\ServiceProviders\\Pricing'
];

No idea what the problem is here. If someone can point me in the right direction I'd really really appreciate it. When I run the cron manually through the Blesta interface it seems to be running perfectly fine.

13 answers to this question

Recommended Posts

  • 0
Posted
  On 8/3/2017 at 9:15 PM, Aphiso said:

I'm having a problem when trying to run the cron. I'm using Plesk Onyx. Here is the command I'm running:

Here is the full error it's kicking back when trying to run the cron:

And here is the content of the config/service.php file:

<?php

return [
    'Blesta\\Core\\ServiceProviders\\MinphpBridge',
    'Blesta\\Core\\ServiceProviders\\Pricing'
];

No idea what the problem is here. If someone can point me in the right direction I'd really really appreciate it. When I run the cron manually through the Blesta interface it seems to be running perfectly fine.

Expand  

What version of PHP are you running? Blesta has a minimum requirement of PHP 5.4. Is it possible your CLI version of PHP is different than the version for your web server?

  • 0
Posted
  On 8/3/2017 at 9:45 PM, Aphiso said:

Just ran php -i and it's showing version 5.3.3. How do I update this?

Expand  

Do you have multi-PHP? If you have multiple versions of PHP, perhaps a newer PHP version is accessible at a different path? Then you can update your cron to use the path to the right version of PHP.

  • 0
Posted
  On 8/3/2017 at 9:45 PM, Aphiso said:

Just ran php -i and it's showing version 5.3.3. How do I update this?

Expand  


I have a general idea on how to do it. But, I really don't want to break anything. Can you help point me in the right direction of properly upgrading the php version?

  Quote

yum install yum-plugin-replace

yum replace --enablerepo=webtatic-testing php-common --replace-with=php56w-common

Expand  

Thats the method I'm thinking of. Not sure how safe it is though. I'm running CentOS 6.

 

  • 0
Posted
  On 8/3/2017 at 9:56 PM, Paul said:

Do you have multi-PHP? If you have multiple versions of PHP, perhaps a newer PHP version is accessible at a different path? Then you can update your cron to use the path to the right version of PHP.

Expand  

Yes, I actually have 5.3 disabled in multi-php. But I have 5.6.31 and 7.0 and 7.1 enabled.

Not sure how to get the cron to run a different PHP version though. Nor, do I know how to find the path. I'm brand new to Plesk and just started running it about a week ago. Guess I'll do some Googling on this.

  • 0
Posted

I am not finding anything very helpful on changing my PHP version. This is getting frustrating. :P

 

@Paul what would be the correct command to use to point the cron to run a different php version? Can you give me an example so I have something to work with?

  • 0
Posted

You would just change your cron job and edit the path to PHP. The standard path on most systems is /usr/bin/php. When a server has multi-PHP, the paths can vary. I'd suggest opening a ticket with Plesk or your server provider if you aren't sure what the path to PHP 7 or PHP 5.6 is. If you're web server is running PHP 7, then you'll want to use the CLI version of PHP 7 also so that it matches your ioncube files.

  • 0
Posted
  On 8/3/2017 at 10:14 PM, Paul said:

You would just change your cron job and edit the path to PHP. The standard path on most systems is /usr/bin/php. When a server has multi-PHP, the paths can vary. I'd suggest opening a ticket with Plesk or your server provider if you aren't sure what the path to PHP 7 or PHP 5.6 is. If you're web server is running PHP 7, then you'll want to use the CLI version of PHP 7 also so that it matches your ioncube files.

Expand  

Okay, I'm running 5.6.31 on my sites right now. Is there a command I can use in the CLI that would show the paths to my PHP versions?

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...