Jump to content
  • 0

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


Aphiso

Question

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

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

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.

Link to comment
Share on other sites

13 answers to this question

Recommended Posts

  • 0
18 minutes ago, 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.

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?

Link to comment
Share on other sites

  • 0
10 minutes ago, Aphiso said:

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

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.

Link to comment
Share on other sites

  • 0
10 minutes ago, Aphiso said:

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


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

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

 

Link to comment
Share on other sites

  • 0
Just now, 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.

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.

Link to comment
Share on other sites

  • 0

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.

Link to comment
Share on other sites

  • 0
Just now, 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.

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?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...