I get no output from my cronjob. The script the job is executing is:

require '/opt/bitnami/apps/wordpress/htdocs/wp-load.php';    

The scheduler code is:

//get the wp-load in for the wordpress functions    
$parse_uri = explode( 'wp-content', $_SERVER['SCRIPT_FILENAME'] );    
require_once( $parse_uri[0] . 'wp-load.php' );

//now try calling template function    

I get no output? The job is to automate social media posts but this doesn't work either.

Any ideas?

  • What do you mean, your cronjob is running a PHP script? What do you have in your crontab file? – G-Man Oct 7 '14 at 1:10
  • Hi, yes it's a php script and the script is: */2 * * * * /opt/bitnami/php/bin/php /opt/bitnami/apps/wordpress/htdocs/wp-content/themes/yeelloe/cron.php >> /opt/bitnami/apps/wordpress/htdocs/vimbackup.log 2>&1 – Eli Reid Oct 7 '14 at 1:16
  • See if you can get a Hello world! PHP program to give you output under cron and let that guide you to a more precise question. – msw Oct 7 '14 at 1:33
  • Cron outputs as it was giving me errors earlier but now nothing is outputting after tweaking the file? – Eli Reid Oct 7 '14 at 1:52

Are you absolutely sure that cron is actually running the script? What I have experienced is that in these cases if the command line is not present, mispelled....cron gets upset and never starts the command up. Which means that no output at all (nor a creation of any output files) specified in the command line.

One final observation, does the PHP script run successfully by just putting the command on the shell line? If not then you'll have to prefix it with the name of the application:

* * * * *    /usr/bin/php /mydirectory/program.php >> output 2>&1

Cron (or UNIX/Linux for that matter) does not connect or associate a file extension with an application like Windows does.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.