Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

CRON and PHP scripts

Discussion in 'General Discussion' started by appcomm, Dec 5, 2007.

  1. appcomm

    appcomm Active Member

    Jan 12, 2004
    Likes Received:
    Trophy Points:
    This one has me stumped!

    Had a server running Redhat 4 and WHM/cPanel (up to date stable). Got a new server, running RedHat 5 and WHM/cPanel (up to date release). Used the WHM Transfer function to migrate the sites over to the new server.

    Now, what I am finding is that CRON jobs that were running fine on the old server will no longer work on the new one. Here's the specifics:

    We run a program on this server for weather creation (forecasts, current condition images, etc.) In particular, we have a PHP script which calls the weather program to generate an image which shows the current conditions for a town and saves it in a folder on the server. This script works fine when we run it on the command line and produces the desired output.

    However, when we setup this script to run as a CRON job, we don't get the output of the image. Instead, it looks like it is just interpreting the script as text and spitting that out as a result of the CRON, but no image.

    Again, I can run this PHP script at the command line and it works every time, but getting it to run as a CRON has me stopped in my tracks. What is really confusing is that it was working on the previous server!

    Here's an example of the script (forecast.php) which runs fine at the command line:
    This will execute properly on the command line in the following two ways:

    1. If I am in the folder with the script and type:


    2. I am anywhere on the server and type:


    When setting up the CRON, I have tried setting the command to run as:


    php /full_server_path_to_script/forecast.php

    Neither of those produce the output of the image as it does when I execute on the command line.

    The version of PHP being used is: PHP 4.4.7 (cli)

    Any words of wisdom about how to get this to run properly again on a CRON?

  2. optrex

    optrex Member

    May 23, 2007
    Likes Received:
    Trophy Points:
    Did you ever get this fixed. I am having a similar problem with a different part of HamWeather

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice