Hello,
I have a PHP page which loads OK 80% of the time. However
the rest of the time I get the following error:
Fatal error: Failed opening required 'DB.php'
This really bugs me, especially since the only reason
this is happeneing seems to be due to server load. I
would like to add code so that instead of displaying
the given error, the PHP code makes the HTTP response
thread simply sleep a little bit (say 4 seconds), and
then retry, and repeat until the file can be opened.
It seems strange to me that server load would prevent
the file from being opened. Anyhow, any ideas on how
I can improve the situation?
Thanks,
Neil 3 2198
On 28 Aug 2004, much to the astonishment of all present at comp.lang.php,
Neil Zanella blurted: Hello,
I have a PHP page which loads OK 80% of the time. However the rest of the time I get the following error:
Fatal error: Failed opening required 'DB.php'
This really bugs me, especially since the only reason this is happeneing seems to be due to server load. I would like to add code so that instead of displaying the given error, the PHP code makes the HTTP response thread simply sleep a little bit (say 4 seconds), and then retry, and repeat until the file can be opened.
It seems strange to me that server load would prevent the file from being opened. Anyhow, any ideas on how I can improve the situation?
Thanks,
Neil
Is the domain you are using for this site using a redirect? If so, I have
had a very similar problem which seemed to be solved by using an absolute
URL path to the include (which is ok as long as it is located above root).
"Neil Zanella" <nz******@cs.mun.ca> wrote in message
news:b6**************************@posting.google.c om... Hello,
I have a PHP page which loads OK 80% of the time. However the rest of the time I get the following error:
Fatal error: Failed opening required 'DB.php'
This really bugs me, especially since the only reason this is happeneing seems to be due to server load. I would like to add code so that instead of displaying the given error, the PHP code makes the HTTP response thread simply sleep a little bit (say 4 seconds), and then retry, and repeat until the file can be opened.
Use include_once() instead. That generates a warning instead of a fatal
error when it fails. Suppress the warning with @, then use
get_included_files() to see if the file was included.
It seems strange to me that server load would prevent the file from being opened. Anyhow, any ideas on how I can improve the situation?
Don't know. Probably an issue at the OS level.
Thanks, your suggestion seems like the best solution to the
problem. Here is the code:
<?php
while (!in_array('DB.php',
array_map('basename', get_included_files()))) {
@include_once('DB.php');
usleep(100000);
}
echo 'finally included!!!';
?>
Regards,
Neil
"Chung Leong" <ch***********@hotmail.com> wrote in message Use include_once() instead. That generates a warning instead of a fatal error when it fails. Suppress the warning with @, then use get_included_files() to see if the file was included.
It seems strange to me that server load would prevent the file from being opened. Anyhow, any ideas on how I can improve the situation?
Don't know. Probably an issue at the OS level. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: superoni |
last post by:
Hello, I use require_once() in all my code that includes a separate
class declared inside there.
However, there are times in certain cases where I will still get a
class redeclaration error. The...
|
by: Justin L. Kennedy |
last post by:
I am having a problem with multiple includes.
A.php require_once on two files: B.php then C.php
C.php require_once on B.php again
Then I get a message:
Warning: main(../../B.php): failed...
|
by: Sean Quinn |
last post by:
Hi,
I don't know if anyone has run into similar problems, but it seems like
when I use `require_once(...)' with files that contain functions I get
an error indicating that it can't redeclare the...
|
by: Ron St-Pierre |
last post by:
We're developing a java app and are using postgres as the database. On
our dev server I started the app, closed it, but the java process was
still open so I killed it, which caused the above error....
|
by: Kimmo Laine |
last post by:
I'm flipping my wig here, people. I'm using classes and making each class a
file. when I'm including dependet classess, I use require_once to avoid
multiple declarations - yet they happen. I put...
|
by: sadique |
last post by:
Hello,
Sadique here
I've been installing a free source hotel booking system and I encountered an error while trying to go to the second step in the installation process.
Fatal error:...
|
by: Royan |
last post by:
Ok the problem is quite hard to explain, but i'll try to keep it as
simple as i can. Imagine I have the following structure of my files
and folders:
/root/global.inc
|__/files/foo.php...
|
by: Ronald Raygun |
last post by:
I have been struggling with this all afternoon and I'm, well lats just
say, very pissed off ...
I have a require once in a file. I am passing the fully qualified (i.e.
absolute pathname) to a...
|
by: Andrew G. Koptyaev |
last post by:
Is I can use include_once() or require_once() in function or only include()?
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |