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?

Login to comment.

Your Opinion Matters

... but we need to know what you're thinking!

The Community Support team wrote the article you're looking at now. We like to think it's perfect, but we're sure you have some suggestions. Please, let us know what they are!

Feedback
Your Email Address
Because we'd like to talk with you!

Have a Question?

If you need some help, submit your question to our Community! We guarantee a response within 60 minutes (8am - 9pm EST, Monday - Friday)

Recent Questions

  1. Wordpress 404 error
  2. email blocked from specific client
  3. WebCalendar Error While Logging On

Support 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.