Re: lost jpeg functionality
From: Shawn Wilson (shawn_at_glassgiant.com)
Date: 11/20/03
- Next message: Michael Flanagan: "Re: Seems like "echo" isn't working (yeah, right)"
- Previous message: David Baer: "Re: Newbie problem with class"
- In reply to: Shawn Wilson: "Re: lost jpeg functionality"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 20 Nov 2003 13:06:17 -0400
Shawn Wilson wrote:
>
> Simon Redmond wrote:
>
> Hi,
>
> I call this function where I want a warning message to go, with the name of the
> function required (i.e. imagecreatefromjpeg):
>
> function warn_function ($funname) {
> if (!function_exists($funname)):
> ?>
> <div align = "center"><div class = "warn" align = "left">
> This script is not working right now. The most likely cause is my host,
> <a href="http://www.veoweb.net" class =
> "warn" target = "_blank">VeoWeb.net</a>, messing something up on the server
> (it's happened often enough for me to put i
> n this automated warning). I have been notified by email that it's not working
> and will strive to fix it quickly.
> </div> </div>
> <?PHP
> endif;
> }
>
> The following script mails me if something one or more functions in
> $functionlist suddenly stops working. It tells me when the build date was and
> lists the functions that don't work. It's set to run every half hour.
>
> <?PHP
> /*
>
> Check to see if functions are working that have a history of not working after
> Veoweb makes changes.
>
> */
>
> $starttime = explode (" ", microtime());
> $starttime = $start_time[1] + $start_time[0];
>
> $email = "Your Name <your@emailaddress.com>";
> $subject = "Website functions not working.";
> $headers = "From: Hosting <your@emailaddress.com>\nX-Priority: 1";
> $message = "Some functions are not working. Please check out immediately.\n\n";
>
> $functionlist = array(
> "imagecreatefromjpeg",
> "imagecreatefrompng",
> "imagecreate",
> "imagecopyresized",
> "imagecopy",
> "imagejpeg",
> "imagepng",
> "imagecreatetruecolor",
> "fopen",
> "mysql_query",
> "filesize",
> "mysql_connect"
> );
>
> sort ($functionlist);
>
> $works = "";
> $notworks = "";
> $builddate = "";
>
> foreach($functionlist as $var) {
> if (function_exists($var))
> $works .= "Function \"$var\" works.\n";
> else
> $notworks .= "Function \"$var\" does not work.\n";
> }
>
> ob_start();
> phpinfo();
> $string = ob_get_contents();
> ob_end_clean();
>
> $string = explode("\n", $string);
>
> foreach($string as $var) {
> $var = strip_tags($var);
> if (preg_match("/^Build Date\s+([A-Za-z]+ [0-9]+ [0-9]+
> [0-9]+:[0-9]+:[0-9]+).+$/", $var)) {
> $var = preg_replace("/^Build Date\s+([A-Za-z]+ [0-9]+ [0-9]+
> [0-9]+:[0-9]+:[0-9]+)[^0-9]?.*$/", "\$1", $
> var);
> $builddate = $var;
> break;
> }
> }
>
> $endtime = explode (" ", microtime());
> $endtime = $start_time[1] + $start_time[0];
>
> if (strlen($notworks) > 0)
> mail($email, $subject, $message . $notworks . "\n" . $works . "\n\nBuild
> Date: $builddate\n\nExecution time: " .
> ($endtime - $starttime) . " sec", $headers);
> echo "DONE";
> ?>
>
> > Hope you don't mind me contacting off board....
> >
> > I'd be real interested in see how you achieved that..... don't want your
> > script per say.... just how you did it....
> >
> > Thats if you don't mind : )
> > Simon
> > ----- Original Message -----
> > From: "Shawn Wilson" <shawn@glassgiant.com>
> > Newsgroups: comp.lang.php
> > Sent: Wednesday, November 19, 2003 1:38 PM
> > Subject: Re: lost jpeg functionality
> >
> > > Simon Redmond wrote:
> > > >
> > > > not there any more
> > > > cheers will get onto the provider tomorrow
> > > > "Matthias Esken" <muelleimer2003nospam@usenetverwaltung.org> wrote in
> > > > message news:bpe8ki.1lg.1@usenet.esken.de...
> > > > > "Simon Redmond" <noreply@sibass.com> schrieb:
> > > > >
> > > > > > my hosting provider just upgraded the server and now some of my
> > scripts
> > > > > > don't work....
> > > > > >
> > > > > > Fatal error: Call to undefined function: imagecreatefromjpeg()
> > > > > >
> > > > > > should I look for something specific in the output from phpinfo()???
> > > > >
> > > > > Yes. Look at the configure command There should be a '--with-gd'
> > > > > somewhere in the configuration line. More information about the
> > > > > configuration of gd should be some blocks down in the phpinfo().
> > >
> > > My host keeps doing this to me. For some reason they don't build GD into
> > PHP
> > > whenever they do a rebuild (every few months). In the past it's taken up
> > to 2
> > > weeks for me to notice that the scripts aren't working. I've asked them
> > to
> > > email me when they make changes to the server, so I can make sure my
> > scripts
> > > still work. They never do. So I now use IF (function_exists()), with an
> > array
> > > of functions I need. If the function doesn't exist, a nicely-formatted
> > error
> > > message is displayed on the screen explaining that my host has made
> > changes
> > > again, screwed up the server and the script will no longer work. It also
> > > mentions that I have been notified and the problem will be remedied
> > shortly. I
> > > put similar code into a cron job that runs every half hour. If the
> > functions
> > > don't exist, I get an email. You might want to consider doing this. I
> > wish I'd
> > > done it a year ago.
I probably should have mentioned: ;o)
IF ANYONE USES THIS SCRIPT, PLEASE CHANGE THE EMAIL ADDRESSES _BEFORE_ YOU
TEST!!!
I am receiving emails telling me functions aren't working.
Thanks,
Shawn
-- Shawn Wilson shawn@glassgiant.com http://www.glassgiant.com
- Next message: Michael Flanagan: "Re: Seems like "echo" isn't working (yeah, right)"
- Previous message: David Baer: "Re: Newbie problem with class"
- In reply to: Shawn Wilson: "Re: lost jpeg functionality"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|