• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Question How to upgrade CLI php of OS ?

hardbrasil

Regular Pleskian
Hi fellas, i having a lot of troubles because php of the OS is so old. 5.4.16
and many applications has issues,

for example for Migrations, Cronjobs, i am getting many issues.

i would like to hear from you guys what you suggest to do in this case.
i know that is not a simple thing to updgrade, butreamin with this doens't help as well

i have an cronjob (mautic app) that is not running because of php version.
 
What's your OS + Version?

You don't need the PHP version that came with your OS. Plesk ships their own PHP versions, up and including to PHP 7.3

* Go to Tools & Settings => Upgrades and Updates
* Make sure you have your desired PHP versions installed or if not, install them
* Then, make sure your subscription is using the desired PHP version
* After that, go to your subscription => Scheduled Tasks and edit your task so that the box "Run a PHP script" is checked
* This will then run the PHP script with the PHP version of your subscription

If you want to run a system cronjob (Tools & Settings => Scheduled Tasks) then you can pick the PHP version under which the job shall be executed
 
Hi, its a centos 7.6 with php 5.4.16

this issue is not related with php seted for subscription. Some services works with php of CLI,
using the schedule tasks under Tool and setings didn't help as well.

my cron is this:
php /path/to/mautic/app/console mautic:segments:update

I supose that this just work with mode: Run a command, becasuse of this instructions: mautic:segments:update

whe i run in "Run a command" i got an php error, that i research is the php version.

if i use "Run a PHP script" -> Could not open input file: php /var/www/vhosts/xpmmn.com.br/httpdocs/crm/app/console mautic:segments:update
if i separate the path of th file and the command i got the same output error.

i need to update this php.
 
Looks like you might be entering a malformed path to your script with the "Run a PHP script" option selected, and that causes the error you're seeing. The path should not start with "php /var/www/...", the "php" part is redundant in this case.

In short, go to the subscription in question and choose the "Scheduled Tasks" icon to set up a user level cron job.

Choose the "Run a PHP script" option.

On the "Script path" line, next to the first form entry field, there should be a folder icon. Use it to choose the path to your script (there must be no "php" in front of the path!). Enter "mautic:segments:update" in the "with arguments" field.

You might also see a "Use PHP version" dropdown and if you do, choose the desired PHP version. If you don't see the "Use PHP version" dropdown, then the user con job will automatically use the PHP version that is selected for the subscription.

Another option you have is to use the system cron instead of the user level cron.

Although, looking at the path of your script, I'd strongly advise you to set up the cron job under the subscription the xpmmn.com belongs to, as instructed above.

But if you do wish to set up a system cron job, start by going to "Tools & Settings" -> "Scheduled Tasks". With the "Run a PHP script" option selected, a new dropdown "Use PHP version" should appear here and you'll be able to select a different PHP version, as long as more PHP versions are installed through Plesk.

Under "Script path" enter only "/var/www/vhosts/xpmmn.com.br/httpdocs/crm/app/console" (without "php" in front of the path) and under "with arguments" enter "mautic:segments:update".

Should the above still be insufficient to solve your issue, report back and we'll try a few other things first. In any case, I advise you not to try updating the CentOS PHP.
 
Back
Top