Go Back   HostGator Peer Support Forums > Public Forums > Pre-Sales Questions

Notices

Reply
 
Thread Tools
  #1  
Old 06-25-2009, 03:14 AM
murtuza_hasan murtuza_hasan is offline
Hatchling Croc
 
Join Date: Jun 2009
Posts: 3
Unhappy Cron Job

I have been trying to run a cron every 30 mins. the command is as follows:

/usr/bin/php /home/username/public_html/myfile.php

But it is giving me a Internal 500 Error.
Please suggest solutions as soon possible.


Thanks All.
Reply With Quote
  #2  
Old 06-25-2009, 05:43 AM
quietFinn's Avatar
quietFinn quietFinn is offline
Veteran Croc
 
Join Date: Feb 2005
Posts: 3,557
Default Re: Cron Job

Quote:
Originally Posted by murtuza_hasan View Post
I have been trying to run a cron every 30 mins. the command is as follows:

/usr/bin/php /home/username/public_html/myfile.php

But it is giving me a Internal 500 Error.
Please suggest solutions as soon possible.


Thanks All.
Change the permissions (chmod) of the file to 644.
__________________
quietFinn - netFinn Finland
"Be who you are and say what you feel because those who mind don't matter and those who matter don't mind." - Dr. Seuss
Reply With Quote
  #3  
Old 06-26-2009, 08:44 AM
murtuza_hasan murtuza_hasan is offline
Hatchling Croc
 
Join Date: Jun 2009
Posts: 3
Default Re: Cron Job

Quote:
Originally Posted by quietFinn View Post
Change the permissions (chmod) of the file to 644.
Thanks for the reply. But the file is already in 644. Is there any alternative to perform the task.

Thanks
Reply With Quote
  #4  
Old 06-26-2009, 09:21 AM
whnp whnp is offline
Hatchling Croc
 
Join Date: Jun 2009
Posts: 1
Default Re: Cron Job

An internal server error (500) is a HTTP error code, not a error a php script would give.

http://en.wikipedia.org/wiki/List_of...x_Server_Error

Its impossible to say without looking at the code, but either you php script is calling a website which returns a 500 error or your cron job is not actually setup as you listed in the first post.

If it really is exactly what you listed, I would open up a ticket with the Hostgator admins, because this is not something we can tell you how to fix without looking at the specific code itself.
Reply With Quote
  #5  
Old 06-26-2009, 09:28 AM
GvilleRick's Avatar
GvilleRick GvilleRick is offline
Emperor Croc
 
Join Date: Jan 2007
Location: Greenville, SC
Posts: 3,130
Default Re: Cron Job

Quote:
Originally Posted by murtuza_hasan View Post
Thanks for the reply. But the file is already in 644. Is there any alternative to perform the task.

Thanks
It's difficult to provide much help with the limited information given. A 500 error is pretty generic, there may be more details in your Error Log in your cPanel that would help. The most common reason is permissions. What is the purpose of the file the cron is calling?
Reply With Quote
  #6  
Old 06-26-2009, 09:37 AM
quietFinn's Avatar
quietFinn quietFinn is offline
Veteran Croc
 
Join Date: Feb 2005
Posts: 3,557
Default Re: Cron Job

Quote:
Originally Posted by whnp View Post
An internal server error (500) is a HTTP error code, not a error a php script would give.

http://en.wikipedia.org/wiki/List_of...x_Server_Error

Its impossible to say without looking at the code, but either you php script is calling a website which returns a 500 error or your cron job is not actually setup as you listed in the first post.

If it really is exactly what you listed, I would open up a ticket with the Hostgator admins, because this is not something we can tell you how to fix without looking at the specific code itself.
In HostGator servers PHP is executed as CGI (using suPHP). Because of that a php file can be writable only by the owner of the file, not more.
If a php file has too wide permissions (like 777 or 666 or even 664) you will get a 500-error when you try to execute that file.
And yes, that error does come from the http server (Apache), not from the php script itself.


EDIT:
Just came to think of it... if that is running as a crontab job, how can it give a 500 error?
__________________
quietFinn - netFinn Finland
"Be who you are and say what you feel because those who mind don't matter and those who matter don't mind." - Dr. Seuss

Last edited by quietFinn; 06-26-2009 at 09:43 AM.
Reply With Quote
  #7  
Old 06-27-2009, 12:23 AM
murtuza_hasan murtuza_hasan is offline
Hatchling Croc
 
Join Date: Jun 2009
Posts: 3
Default Re: Cron Job

Thanks all for your replies.

The php script i am using is working with the twitter api's to search profiles and tweets. When i am running the script independently its fine. but the script take about 5-8 minutes to execute. The error is resolved when i am removing the cron.

Is it the process time of the script? i am not very well versed with cpanel. But there is a place in cpanel where its showing the process logs. The max processes is 25. But when ever the cron is running its going upto 32. Then is when the error is getting fired.

I hope this information will be of some use to resolve the problem.

Thanks.
Reply With Quote
  #8  
Old 06-27-2009, 02:08 AM
striddy's Avatar
striddy striddy is offline
Veteran Croc
 
Join Date: Mar 2008
Location: /home/australia/earth
Posts: 4,093
Default Re: Cron Job

Quote:
Originally Posted by murtuza_hasan View Post
When i am running the script independently its fine. but the script take about 5-8 minutes to execute. The error is resolved when i am removing the cron.

Is it the process time of the script? i am not very well versed with cpanel. But there is a place in cpanel where its showing the process logs. The max processes is 25. But when ever the cron is running its going upto 32. Then is when the error is getting fired.
The HG Tos (link at bottom of page) states:
Quote:
7. Resource Usage
User may not:
a) Use 25% or more of system resources for longer then 90 seconds.
You might want to submit a ticket to support to see if that's the reason your script is failing.
__________________
- David
Reply With Quote
  #9  
Old 06-27-2009, 02:40 AM
gwyneth's Avatar
gwyneth gwyneth is offline
Supreme Croc
 
Join Date: Sep 2006
Location: up north
Posts: 6,843
Default Re: Cron Job

Plus this might considered to violate the next TOS provision, "b) Run stand-alone, unattended server-side processes at any point in time on the server".
Reply With Quote
  #10  
Old 06-27-2009, 06:30 AM
eLIANT eLIANT is online now
King Croc
 
Join Date: Apr 2005
Posts: 1,075
Default Re: Cron Job

Quote:
Originally Posted by gwyneth View Post
"b) Run stand-alone, unattended server-side processes at any point in time on the server".
Unfortunately, this rule is impossible to comprehend since all .php scripts (including the ubiquitous phpinfo.php) are "stand-alone, unattended server-side processes."
__________________

eLIANT Technology Services
(site feedback welcome)
Reply With Quote
  #11  
Old 06-27-2009, 01:17 PM
gwyneth's Avatar
gwyneth gwyneth is offline
Supreme Croc
 
Join Date: Sep 2006
Location: up north
Posts: 6,843
Default Re: Cron Job

Quote:
Originally Posted by eLIANT View Post
Unfortunately, this rule is impossible to comprehend since all .php scripts (including the ubiquitous phpinfo.php) are "stand-alone, unattended server-side processes."
Yeah, I know, which is why I said 'might'.

phpinfo.php, though is normally run by the person browsing to that address, so it's not unattended.

and while cron entries are normally unattended, they're not stand-alone, since they run something else.

eLiant, you might bring this provision up in the thread in the suggestons category about clarifying the TOS.

Last edited by gwyneth; 06-27-2009 at 01:20 PM.
Reply With Quote
  #12  
Old 06-27-2009, 03:50 PM
eLIANT eLIANT is online now
King Croc
 
Join Date: Apr 2005
Posts: 1,075
Default Re: Cron Job

Good point. Thread updated.
__________________

eLIANT Technology Services
(site feedback welcome)
Reply With Quote
Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
ssh/cron aetchell Pre-Sales Questions 11 07-01-2009 11:40 AM
Cron Job osirion Suggestions 1 01-29-2008 02:39 AM
Cron Job Dwight Shared Hosting Support 7 07-27-2006 05:10 PM

All times are GMT -5. The time now is 07:54 PM.