Re: Friday morning brain farts....
| From: | Tijnema | Date: | Fri, 10 Aug 2007 17:49:14 +0000 |
| Subject: | Re: Friday morning brain farts.... | ||
| References: | 1 2 3 4 5 6 7 8 9 10 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-260627@lists.php.net to get a copy of this message | ||
On 8/10/07, Robert Cummings <robert@interjinn.com> wrote:
> On Fri, 2007-08-10 at 19:21 +0200, Tijnema wrote:
> > On 8/10/07, Robert Cummings <robert@interjinn.com> wrote:
> > > On Fri, 2007-08-10 at 11:48 -0400, Daniel Brown wrote:
> > > > On 8/10/07, Stut <stuttle@gmail.com> wrote:
> > > > > .... I get an email from each
> > > > > server containing the contents of the error log from the previous day
> > > > > and my first task each day is to go through that and track down any
> > > > > issues that usage has highlighted.
> > > >
> > > > That's actually a good point there that I can take away from this.
> > > > I actually don't have anything set to send me a log of code issues,
> > > > only when an error is caused (and, of course, anything server-related,
> > > > but that's a different point entirely).
> > >
> > > Simple enough... put the following in a file, and add a cron job.
> > >
> > > #!/usr/bin/php -qC
> > > <?php
> > >
> > > if( !isset( $argv[1] ) || !isset( $argv[2] ) || !isset( $argv[3] ) )
> >
> > if(!isset($argv[1],$argv[2],$argv[3])) // Bit shorter ;)
>
> Quite true.
>
> > > {
> > > echo "Usage: {$argv[0]} <subject> <email> <path>\n";
> > > exit( 1 );
> > > }
> > >
> > > $subject = $argv[1];
> > > $email = $argv[2];
> > > $path = $argv[3];
> > >
> > > $content = implode( '', file( $path ) );
> >
> > $content = file_get_contents($path); // Safe to require PHP 4 >= 4.3.0 right?
>
> I always forget about file_get_contents() because its counterpart
> file_put_contents() for some ungodly reason didn't appear until PHP 5.
Forget PHP4 and life becomes a lot easier :)
Tijnema
--
Vote for PHP Color Coding in Gmail! -> http://gpcc.tijnema.info