Gossamer Forum
Home : General : Internet Technologies :

PHP: UNLINK/Cron

Quote Reply
PHP: UNLINK/Cron
Hi all,

I have an issue pertaining to running a PHP script via Cron. The script has run fine up until a couple weeks ago. I notice that the reason that the script has not been totally working is that the temp email files were not being deleted when running via Cron. When I run the script via the browser, the script runs, including the deletion of the temp email files (using them for HTML dynamically formatted mass email messages).

Anyway, I was using the following codes:

Code:
unlink("../includes/templates/emails/files/" . $my_check_file_name);

which worked fine via the browser. But didn't delete the files when execuited via Cron.

So, I changed the codes to the following:

Code:
unlink($_SERVER['DOCUMENT_ROOT'] . "/includes/templates/emails/files/" . $my_check_file_name);

Still works via the browser, but wanting to confirm whether this will work via Cron, just looking for confirmation rather than testing it via Cron, which is more time consuming. ;)

Thanks in advance.
========================================
Buh Bye!

Cheers,
Me
Quote Reply
Re: [Stealth] PHP: UNLINK/Cron In reply to
Yeah, that should work. You could also probably get around it with

Code:
chdir($_SERVER['DOCUMENT_ROOT']);

Cheers

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Quote Reply
Re: [Andy] PHP: UNLINK/Cron In reply to
Thanks, Andy...have to wait a week to see if it works...of course, I could test it by updating the Crontab to a closer time period, but this particular mass email is sent out once a week.
========================================
Buh Bye!

Cheers,
Me
Quote Reply
Re: [Stealth] PHP: UNLINK/Cron In reply to
Never thought I would see the day when I'm giving you advice on coding Angelic

Cheers

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates