Web Hosting Forum | Lunarpages
News: July 14, 2008 - New Contest! - Submit Your WordPress Theme Designs, Win BIG!
August 25, 2008 - Time to Vote for the August 2008 Site of the Month!
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
August 29, 2008, 11:10:30 PM


Login with username, password and session length


Pages: [1]   Go Down
  Print  
Author Topic: Cron Tab - Permission Denied.  (Read 121 times)
Metallerz
Trekkie
**
Offline Offline

Posts: 12


« on: July 21, 2008, 01:30:42 PM »

Ok I am on Business Hosting, and part of my business requires running Cron Tabs. I set one up today to run every 10 minutes and it is saying Permission Denied.

Why is it saying this?

Surely it can't be because it is being run too frequently, otherwise how can LunarPages justify the huge price difference between Basic and Business if the only difference between the two is storage. Surely Business Hosting should be able to use more resources. I can understand not being able to run a ten minute Cron Tab on Basic Hosting but really this is ridiculous.

Hopefully I am wrong and somebody can set this right for me.

Thanks.
Logged
Ibanez Player 85
Galactic Royalty
*****
Offline Offline

Posts: 428


WWW
« Reply #1 on: July 21, 2008, 03:08:32 PM »

Did you set up your path correctly to the script?  I would imagine if the path isn't set right, you might get a permission error.  Also, depending on the script, maybe you have to set a specific permission on the file itself that you're running?  Just throwing out ideas here...
Logged

Refined Web Design
http://refinedwebdesign.com
Metallerz
Trekkie
**
Offline Offline

Posts: 12


« Reply #2 on: July 21, 2008, 05:16:59 PM »

Hello and thank you for your reply.

The path is correct, I typed the absolute path into the Cron Tab Standard feature via cPanel, example /home/user/public_html/cron.php

I will set permission to 777 and change the time to every 20 minutes and report back here.

If it fails again I will open a ticket.
Logged
Ibanez Player 85
Galactic Royalty
*****
Offline Offline

Posts: 428


WWW
« Reply #3 on: July 21, 2008, 05:47:59 PM »

One other thing you might want to try is running the script from your browser as a test (i.e., not through cron), just to see if the script itself is working properly.  For example, upload the file to your /public_html/ folder and type the address in your browser.  If it works, you know it's something wrong with either the path, permissions, or something with cron.  If it doesn't work, then the script is at fault.
Logged

Refined Web Design
http://refinedwebdesign.com
MrPhil
Quantum Encyclopedia Writer
*****
Offline Offline

Posts: 3237



« Reply #4 on: July 21, 2008, 07:32:37 PM »

Don't set any file or directory to 777 permissions (or 666 or any other "world writable"). The system security software will prevent you from running. 755 or 644 should be sufficient for anything you need to do.

Are you setting up a cron job via cPanel > Cron jobs > Advanced? What is the full command you're using? For PHP code, it would normally be php -q /home/ACCOUNT/public_html/cron.php. If you're trying to run cron.php directly, what are you using for your #! line? Where are you getting the error message -- in the Cron panel or in an email from the job?
Logged

Metallerz
Trekkie
**
Offline Offline

Posts: 12


« Reply #5 on: July 22, 2008, 09:13:22 AM »

Hello and thanks again for the replys.

After playing around in cPanel I finally got some action. Although I did set the cron script to 777, I will now be changing that for security as mentioned by MrPhil. I also had to set the Cron Job to run every hour for it to work, but its still not actually working.

I used the Cron Job feature in cPanel and selected Standard mode. I then entered the time accordingly.

My problem now is the Cron Job seems to be trying to execute comments in the php file.

This is what I received by email:

Quote
/home/USER/public_html/DIRECTORY/_cron/gold.php: line 1: ?php: No such file or directory
/home/USER/public_html/DIRECTORY/_cron/gold.php: line 2: syntax error near unexpected token `C'
/home/USER/public_html/DIRECTORY/_cron/gold.php: line 2: `/* (C) ABK-Soft Ltd., 2004-2006'

It never mentioned if the Cron Job has been executed or if it has failed, but I am assuming it has failed.

Here is the exact Cron Job I am trying to run:

Code:
<?php
/* (C) ABK-Soft Ltd., 2004-2006
IMPORTANT: This is a commercial software product
and any kind of using it must agree to the ABK-Soft
Ltd. license agreement.
It can be found at http://abk-soft.com/license.doc
This notice may not be removed from the source code. */

include_once(dirname(__FILE__) . DIRECTORY_SEPARATOR ".." DIRECTORY_SEPARATOR "_include" DIRECTORY_SEPARATOR "config" DIRECTORY_SEPARATOR "main.php");
include_once(
dirname(__FILE__) . DIRECTORY_SEPARATOR ".." DIRECTORY_SEPARATOR "_include" DIRECTORY_SEPARATOR "config" DIRECTORY_SEPARATOR "options.php");
include_once(
dirname(__FILE__) . DIRECTORY_SEPARATOR ".." DIRECTORY_SEPARATOR "_include" DIRECTORY_SEPARATOR "lib" DIRECTORY_SEPARATOR "lib.php");
include_once(
dirname(__FILE__) . DIRECTORY_SEPARATOR ".." DIRECTORY_SEPARATOR "_include" DIRECTORY_SEPARATOR "lib" DIRECTORY_SEPARATOR "db.php");
include_once(
dirname(__FILE__) . DIRECTORY_SEPARATOR ".." DIRECTORY_SEPARATOR "_include" DIRECTORY_SEPARATOR "config" DIRECTORY_SEPARATOR "db.php");
error_reporting(2047);
ini_set("display_errors"1);
DB::connect();
$subject DB::result("SELECT subject FROM email_auto WHERE note='end_gold'");
$text DB::result("SELECT text FROM email_auto WHERE note='end_gold'");
DB::query('SELECT * FROM user WHERE gold_days=1');
while (
$row DB::fetch_row()) {
$subject str_replace("{title}"$g['main']['title'], $subject);
$text str_replace("{title}"$g['main']['title'], $text);
$text str_replace("{name}"$row['name'], $text);
send_mail($row['mail'], $g['main']['info_mail'], $subject$text);
}
DB::execute("UPDATE user SET gold_days=(gold_days-1), last_visit=last_visit WHERE gold_days>0;");
DB::close();

This script is from a very popular and professional vendor, I have contacted them but they say the problem is with my host.

Any ideas or will I open a ticket?
Logged
MrPhil
Quantum Encyclopedia Writer
*****
Offline Offline

Posts: 3237



« Reply #6 on: July 22, 2008, 07:45:42 PM »

What is the exact command that you're giving? It should be

php -q /home/user/public_html/cron.php <<optional flags and redirections>>.

It sounds like you're trying to run cron.php directly as a script, like Perl or bash. If that can even be done, I'd assume you'd need a first line with #!/usr/bin/php -q (or whatever the proper path to PHP is).
Logged

Metallerz
Trekkie
**
Offline Offline

Posts: 12


« Reply #7 on: July 22, 2008, 09:03:26 PM »

Thank you once agin MrPhil, I forget to put php infront of the path.

It now looks like this:

php /home/user/public_html/cron.php

In my email I get this:

X-Powered-By: PHP/4.4.7
Content-type: text/html

So is this working? I think so...

MrPhil could you please tell me what the -q means between php and /home/ do I need to add this and what does it do?

Thank you once again.
Logged
MrPhil
Quantum Encyclopedia Writer
*****
Offline Offline

Posts: 3237



« Reply #8 on: July 23, 2008, 05:35:08 PM »

It's the "quiet" flag. It says not to output the header stuff that marks it as a web page to be displayed on a browser. In other words, you're just using PHP as a programming language in a script, not trying to put up a web page. Putting in "-q" should get rid of

X-Powered-By: PHP/4.4.7
Content-type: text/html
Logged

Metallerz
Trekkie
**
Offline Offline

Posts: 12


« Reply #9 on: July 23, 2008, 10:59:26 PM »

Thank you again.
Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.3 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks


Valid XHTML 1.0! Valid CSS! Dilber MC Theme by HarzeM