You are here: How to catch a failed opening required ... (require_once) ? « All PHP « IT news, forums, messages
How to catch a failed opening required ... (require_once) ?

Posted by Pugi! on 08/09/06 15:36

Hi,
How can you catch a fatal error that occurs when you use a
require_once("myfile.php") and the file dioesn't exist ?
I tried:
try {
require_once("p.php");
} catch (Exception $e) {
echo $e->getMessage();
}
but it returns
Warning: require_once(p.php) [function.require-once]: failed to open stream:
No such file or directory in D:\apache\xampp\htdocs\site\untitled.php on
line 12

Fatal error: require_once() [function.require]: Failed opening required
'p.php' (include_path='.;D:\apache\xampp\php\pear\') in
D:\apache\xampp\htdocs\site\untitled.php on line 12

So the try/catch is in fact completely ignored.

Pugi!

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация