Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 548093
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T11:02:34+00:00 2026-05-13T11:02:34+00:00

So I have a cronjob which executes a PHP script like so: 0 0

  • 0

So I have a cronjob which executes a PHP script like so:

0 0 * * * /usr/local/bin/php -f /home/mysite/mysite.com/cronjobs/renewal_email.php

If I issue the same command from the command line it runs without error and running with the l flag shows no syntax errors. However cron emails the following:

Parse error: syntax error, unexpected T_OBJECT_OPERATOR

The line in question is

$courses[$t->CourseNumber] = $t->course()->CourseName;

Does this limited amount of info raise any red flags? Anyone see why this should happen under cron but not from the command line?

// Edit to add DreamHost support response. Script is working with this change.

The default version of PHP on the server is PHP4. This is because the server uses the PATH settings rather than the Apache to specify which version is run. The path for PHP4 /usr/local/bin/php comes before the PHP5 path /usr/local/php5/bin/php so it always runs first when you type php from the shell.

To run PHP5 from the shell you need to specify the entire path:

/usr/local/php5/bin/php --version

The cron user will not use your .bash_profile path so you would need to specify the full path to PHP5 in each cron job.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T11:02:35+00:00Added an answer on May 13, 2026 at 11:02 am

    Hm. The error message sounds like you’re running a PHP5 script on a PHP4 interpreter. However, if you use the exact same path to the PHP binary, I can’t see how this could happen.

    Can you have the cron job do a phpinfo() and see what the output is?

    For PHP 4, you’d have to rewrite the instruction:

    $temp = $t->course(); 
    $courses[$t->CourseNumber] = $temp->CourseName;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 278k
  • Answers 278k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I recommend JPA -- while it's a standard, it is… May 13, 2026 at 3:15 pm
  • Editorial Team
    Editorial Team added an answer Actually, further to my comment to Thomas, this is possible… May 13, 2026 at 3:15 pm
  • Editorial Team
    Editorial Team added an answer Found the answer. It is much simpler than I was… May 13, 2026 at 3:15 pm

Related Questions

My setup: Ubuntu LAMP, application built w/ zend framework My Problem: I have a
I have a cron job the executes a PHP script. The cron is setup
I am making an auction website, which has an auto-bid system. This system lets
I have a file update.php which does some MySQL operations. A cron job executes
I'm running a cronjob which needs to write data to a cache. I wanted

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.