Go Back   Trackpads Community > General Discussions > Computer and Technology > Web Design

Web Design Forums and discussions on webdesign

Web Design

Reply
 
LinkBack Thread Tools
Old 08-15-2005, 20:00   #1 (permalink)
zeebop
Civilians

 
Default Help needed with cron job

Hi,

I can manually run a file on my webserver and it completes its action
fine.

I am trying to run this with a cron job via the GUI interface for cron
on cpanel.

This is the error I'm getting:

/home/condomch/public_html/catalog/admin/froogle.php: ?php: No such
file or directory
/home/condomch/public_html/catalog/admin/froogle.php: //: is a
directory
/home/condomch/public_html/catalog/admin/froogle.php: //: is a
directory
/home/condomch/public_html/catalog/admin/froogle.php: line 4: syntax
error near unexpected token `explode('
/home/condomch/public_html/catalog/admin/froogle.php: line 4: `$stimer
= explode( ' ', microtime() );'

Any ideas where I'm going wrong?

zeebop
 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Trackpads Information
Click to Visit
Old 08-15-2005, 20:00   #2 (permalink)
zeebop
Civilians

 
Default Re: Help needed with cron job

On 15 Aug 2005 2054 GMT, Kim André Akerĝ
<kimandre@NOSPAMbetadome.com> wrote:

>zeebop wrote:
>
>> Hi,
>>
>> I can manually run a file on my webserver and it completes its action
>> fine.
>>
>> I am trying to run this with a cron job via the GUI interface for cron
>> on cpanel.
>>
>> This is the error I'm getting:
>>
>> /home/condomch/public_html/catalog/admin/froogle.php: ?php: No such
>> file or directory
>> /home/condomch/public_html/catalog/admin/froogle.php: //: is a
>> directory
>> /home/condomch/public_html/catalog/admin/froogle.php: //: is a
>> directory
>> /home/condomch/public_html/catalog/admin/froogle.php: line 4: syntax
>> error near unexpected token `explode('
>> /home/condomch/public_html/catalog/admin/froogle.php: line 4: `$stimer
>> = explode( ' ', microtime() );'
>>
>> Any ideas where I'm going wrong?

>
>What does the very first line of your froogle.php file look like?


First few lines are as follows:
<?php
// Start TIMER
// -----------
$stimer = explode( ' ', microtime() );
$stimer = $stimer[1] + $stimer[0];
// -----------
 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 08-15-2005, 20:00   #3 (permalink)
Charles Sweeney
Civilians

 
Default Re: Help needed with cron job

zeebop wrote

> First few lines are as follows:
> <?php
> // Start TIMER
> // -----------
> $stimer = explode( ' ', microtime() );
> $stimer = $stimer[1] + $stimer[0];
> // -----------


You need a shebang line before the PHP. Typically:

#!/usr/bin/php -q

<?php
> // Start TIMER


To find the path to PHP (in the shebang line) type this command:

whereis php

--
Charles Sweeney
http://CharlesSweeney.com
 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 08-15-2005, 20:00   #4 (permalink)
Chris Hope
Civilians

 
Default Re: Help needed with cron job

Charles Sweeney wrote:

> zeebop wrote
>
>> First few lines are as follows:
>> <?php
>> // Start TIMER
>> // -----------
>> $stimer = explode( ' ', microtime() );
>> $stimer = $stimer[1] + $stimer[0];
>> // -----------

>
> You need a shebang line before the PHP. Typically:
>
> #!/usr/bin/php -q


However, as per my previous post, you don't want that there if the
script is /also/ to be run from the web server, otherwise the shebang
line will output to the browser. If this is the case then you can run
the script by calling /path/to/php /path/to/script

> <?php
>> // Start TIMER

>
> To find the path to PHP (in the shebang line) type this command:
>
> whereis php


--
Chris Hope | www.electrictoolbox.com | www.linuxcdmall.com
 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 08-15-2005, 20:00   #5 (permalink)
Chris Hope
Civilians

 
Default Re: Help needed with cron job

Chris Hope wrote:

> Charles Sweeney wrote:
>
>> zeebop wrote
>>
>>> First few lines are as follows:
>>> <?php
>>> // Start TIMER
>>> // -----------
>>> $stimer = explode( ' ', microtime() );
>>> $stimer = $stimer[1] + $stimer[0];
>>> // -----------

>>
>> You need a shebang line before the PHP. Typically:
>>
>> #!/usr/bin/php -q

>
> However, as per my previous post, you don't want that there if the
> script is /also/ to be run from the web server, otherwise the shebang
> line will output to the browser. If this is the case then you can run
> the script by calling /path/to/php /path/to/script
>
>> <?php
>>> // Start TIMER

>>
>> To find the path to PHP (in the shebang line) type this command:
>>
>> whereis php

>


Oh and incidentally, I'd either forgotten or didn't know they were
called shebang lines. Hopefully I'll remember next time Thanks
Charles.

--
Chris Hope | www.electrictoolbox.com | www.linuxcdmall.com
 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 08-15-2005, 20:00   #6 (permalink)
Charles Sweeney
Civilians

 
Default Re: Help needed with cron job

Chris Hope wrote

> Charles Sweeney wrote:
>
>> zeebop wrote
>>
>>> First few lines are as follows:
>>> <?php
>>> // Start TIMER
>>> // -----------
>>> $stimer = explode( ' ', microtime() );
>>> $stimer = $stimer[1] + $stimer[0];
>>> // -----------

>>
>> You need a shebang line before the PHP. Typically:
>>
>> #!/usr/bin/php -q

>
> However, as per my previous post, you don't want that there if the
> script is /also/ to be run from the web server, otherwise the shebang
> line will output to the browser. If this is the case then you can run
> the script by calling /path/to/php /path/to/script


Quite so. You already said that.

I have made some PHP scripts that I run from cron. None are intended to
be output to a browser. I sometimes do so when I am testing them, so I
don't mind the shebang line appearing on the screen in such instances.

--
Charles Sweeney
http://CharlesSweeney.com
 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 08-15-2005, 20:00   #7 (permalink)
Charles Sweeney
Civilians

 
Default Re: Help needed with cron job

Chris Hope wrote

> Oh and incidentally, I'd either forgotten or didn't know they were
> called shebang lines. Hopefully I'll remember next time Thanks
> Charles.


)

I probably picked that up in here from some old Perl hack!

--
Charles Sweeney
http://CharlesSweeney.com
 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
CPanel Cron Jobs (aka Son of the Cron Job thread ~or~ There and BackAgain) Dylan Parry Web Design 2 06-19-2005 16:00
Re: Cron job ? Toby Inkster Web Design 2 06-12-2005 12:00
Re: Cron job ? Baho Utot Web Design 27 06-12-2005 08:00
Re: Cron job ? Matt Probert Web Design 5 06-11-2005 20:00
Re: Cron job ? Toby Inkster Web Design 3 06-11-2005 08:00


Community Information
Options
Quick Options
Trackpads Non-Commercial Ad
Copyright Information Click to Visit
Time
Server Time
All times are GMT -4. The time now is 20:36.
Copyright
Copyright Information
The header is based off of work by Vipixel.com and modified by this site. Trackpads and the Trackpads Logo are both Registered Trademarks of Jason Edwards and cannot be used without prior written permission.  The only exception is as a link back to this site. Trackpads is a private website run by a small legion of volunteers, 3 dogs, 12.5 cats and an army of small, super smart, bio-engineered mice with pointy hats and tutu's. Search Engine Friendly URLs by vBSEO 3.2.0 RC7
Archive Links
Archive Links
Page generated in 0.94418 seconds with 20 queries