With our newer servers, you are able to select which php version you want to use with your cPanel account. This allows you to set the appropriate php version to use with your selected applications. Some versions of applications requires specific php versions. For example, Moodle versions 2.x require php version 5.3.2 and up. While you can set the php version for use within your cPanel, when setting a cron job, it does not automatically use the same version, but relies on the server default. You must adjust your command code to specifically select the php version. Follow along below as we explain how to set your cron job command line to work with the desired version of php.

Forcing the right php version for cron jobs

  1. Log into your cPanel dashboard.
  2. From your main cPanel screen, locate the Advanced category. From there, find and click on the cronjobs icon.
    select cronjobs icon
  3. At the bottom of the screen you will see the cron jobs you have set up. Click on the Edit link on the right to edit the command.
    list of cron jobs
  4. This will display the command line field so you can edit it. In the first part of the cron command, before the path to the script, you will see that it calls php -q. For example, this is the original code for a sample cronjob below:
    php -q /home/userna5/public_html/testcron.php
    We want to replace the php -q part of the code with /opt/php54/bin/php -q for php 5.3 and above as shown:
    /opt/php54/bin/php -q /home/userna5/public_html/testcron.php
    or the following for php 5.2:
    /opt/php52/bin/php -q /home/userna5/public_html/testcron.php
  5. After entering your new command line, click the Edit Line button to save the new changes. The chosen cron job will now use your desired php version. Do this for each cron job so they will use the correct php version.

 

Did you find this article helpful?

We value your feedback!

Why was this article not helpful? (Check all that apply)
The article is too difficult or too technical to follow.
There is a step or detail missing from the instructions.
The information is incorrect or out-of-date.
It does not resolve the question/problem I have.
How did you find this article?
Please tell us how we can improve our Help Center:
Email Address
Optional, but our team may contact you for more information.
Did you find this article helpful?

Post a Comment

Name:
Email Address:
Comment:
Are you a bot?
Submit

Please note: Your name and comment will be displayed, but we will not show your email address.

News / Announcements

Update to SSL Certificates - Certificate Warnings
1969-12-31 11:00 am EST
Hits: 649

Related Questions

Here are a few questions related to this article that our customers have asked:
Ooops! It looks like there are no questions about this page.
Would you like to ask a question about this page? If so, click the button below!

Help Center Search

Current Customers

Email: support@WebHostingHub.com Ticket: Submit a Support Ticket
Call: 877-595-4HUB (4482)
757-416-6627 (Intl.)
Chat: Click To Chat Now

Ask the Community

Get help with your questions from our community of like-minded hosting users and Web Hosting Hub Staff.

Not a Customer?

Get web hosting from a company that is here to help.