NYCPHP Meetup

NYPHP.org

[nycphp-talk] fopen killed the script

LIAO YANG heli_travel at yahoo.com
Tue May 27 17:12:37 EDT 2003


Thanks Josh, I now understand it, it works !

--- joshmccormack at travelersdiary.com wrote:
> Looks like the file you wanted fopen to use wasn't found (404
> error). Make sure you have the correct path set, and to verify
> that your script is working you may want to use a test file in
> the simplest places possible. 
> 
> Josh
> 
> On Tue, 27 May 2003, LIAO YANG wrote:
> 
> > Thanks for the hint! I just copied the following code from 
> > php.net and used it,
> > 
> > I got this "[function.fopen]: failed to create stream: HTTP
> > request failed! HTTP/1.1 404 Not Found"
> > 
> > is this a configuration problem?
> > 
> > here is the code I copied from php.net:
> > 
> > // redefine the user error constants - PHP 4 only
> > define ("FATAL",E_USER_ERROR);
> > define ("ERROR",E_USER_WARNING);
> > define ("WARNING",E_USER_NOTICE);
> > 
> > // set the error reporting level for this script
> > error_reporting (FATAL | ERROR | WARNING);
> > 
> > // error handler function
> > function myErrorHandler ($errno, $errstr, $errfile,
> $errline) {
> >   switch ($errno) {
> >   case FATAL:
> >     echo "<b>FATAL</b> [$errno] $errstr<br>\
";
> >     echo "  Fatal error in line ".$errline." of file
> ".$errfile;
> >     echo ", PHP ".PHP_VERSION." (".PHP_OS.")<br>\
";
> >     echo "Aborting...<br>\
";
> >     exit(1);
> >     break;
> >   case ERROR:
> >     echo "<b>ERROR</b> [$errno] $errstr<br>\
";
> >     break;
> >   case WARNING:
> >     echo "<b>WARNING</b> [$errno] $errstr<br>\
";
> >     break;
> >     default:
> >     echo "Unkown error type: [$errno] $errstr<br>\
";
> >     break;
> >   }
> > }
> > 
> > // function to test the error handling
> > function scale_by_log ($fp) {
> >   if ( $fp < 0 )
> >     trigger_error("log(x) for x <= 0 is undefined, you used:
> fp
> > = $fp",
> >       FATAL);
> >     return 0;
> > }
> > 
> > // set to the user defined error handler
> > $old_error_handler = set_error_handler("myErrorHandler");
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > --- joshmccormack at travelersdiary.com wrote:
> > > You can see an example of using an error message with
> fopen,
> > > and logging it here:
> > >
> >
>
http://www.devshed.com/Server_Side/PHP/DBAbstraction/page10.html
> > > 
> > > Josh
> > > 
> > > On Tue, 27 May 2003, LY wrote:
> > > 
> > > > Hi All,
> > > > Normally when fopen("a.txt","r") can't open a file,
> either
> > > the
> > > > file doesn't exist, or can't read, it should return
> "FALSE",
> > > but
> > > > my "fopen" kill my script and no error message printed
> out.
> > > > Could someone help to tell if it is PHP configuration
> > > problem,
> > > > or a PHP bug? How to log this error message? 
> > > > 
> > > > Thanks in advance!
> > > > 
> > > > LY
> > > > 
> > > > 
> > > > __________________________________
> > > > Do you Yahoo!?
> > > > The New Yahoo! Search - Faster. Easier. Bingo.
> > > > http://search.yahoo.com
> > > > 
> > > > 
> > > > 
> > > > 
> > > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > 
> > 
> > __________________________________
> > Do you Yahoo!?
> > The New Yahoo! Search - Faster. Easier. Bingo.
> > http://search.yahoo.com
> > 
> > 
> > 
> > 
> > 
> 
> 
> 
> --- Unsubscribe at http://nyphp.org/list/ ---
> 
> 


__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com



More information about the talk mailing list