|
Posted by Jerry Stuckle on 05/11/05 19:05
jerrygarciuh wrote:
> Hello,
>
> I have a script running in the wee hours via cron job. When I access the
> script via browser it works like a charm. I noticed it was not succeeding
> and ran it manually from the command line and it threw a Segmentation Fault.
>
> Googling produces a ton of information on this subject but al of specific to
> certain binaries and it doesn't seem germaine to solving my problem.
>
> Any one have any advice? Whole script is below.
>
> TIA,
>
> jg
>
> <?
> mysql_connect('mysql.example.com', 'example', 'example');
> mysql_select_db('example');
> mysql_query("DELETE FROM aniSessionLog WHERE timestamp < NOW() - 900");
> $rows = mysql_affected_rows();
> mail('jg@example.com', 'cleaned Intranet DB', "$rows rows deleted.");
> ?>
>
>
One thought here - are you using the same version of PHP in both cases?
Perhaps you updated PHP - but left the old one as the default binary.
To find out, run php -v from the command line and use phpinfo() from
the web server.
The only other thing I can think of is if the user the cron job is
running under doesn't have permissions for mysql or mail access.
Try commenting out the mail() call to see if that does it. If not, work
back, commenting out statements until it works (or until nothing is left
- in which case the connect has problems).
BTW - you could also close the connection when you're done. It's
cleaner than letting the system clean up for you.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Navigation:
[Reply to this message]
|