I have a PHP script that uses require_once to load modules. It's run hourly by CRON and was working OK Since adding another module, it still works OK overnight (presumable when the load is low) but frequently fails (crashes) during the day. I added some monitoring code to the functions in the module to see whee it fails and it's definitely where it tries to load the module. In an attempt to ascertain why the script was failing to load the module, I changed the require_once to include_once. For some reason, that seems to have solved the problem - the functions in the module are being executed. Can anyone explain why require_once fails to load the module but include_once succeeds? Has anyone even encountered this problem before?
Why would PHP include_once succeed but require_once, on the same file, fail?
374 Views Asked by Mike At
1
There are 1 best solutions below
Related Questions in PHP
- php Variable name must change in for loop
- register_shutdown_function is not getting called
- Query returning zero rows despite entries existing
- Retrieving *number* pages by page id
- Automatically closing tags in form input?
- How to resize images with PHP PARSE SDK
- how to send email from localhost using codeigniter?
- Mariadb max Error while sending QUERY packet PID
- Multiusers login redirect different page in php
- Imaginary folder when I use "DirectoryIterator" in PHP?
- CodeIgniter + XDebug: debug only working in the main controller, index() function
- PHP script timeout when I use sleep()
- posting javascript populated form to another php page
- AJAX PHP - Reload div after submit
- PHP : How can I check Array in array?
Related Questions in REQUIRE-ONCE
- Fatal error: Call to a member function connect() on a non-object in /includes/online.inc.php on line 5
- Define CONSTANT not working, why?
- Find targeted #id from parent includer with php
- Assist with diagnosing PHP include, failed to open stream
- Required_once file not routing correctly
- Satisfy 3 conditions in a If/Else statement php page
- Project running on local server (WAMP) but on live server Error: failed to open stream: No such file or directory
- Function file will not recognize included PDO database connection
- Approaching dynamic php includes on legacy projects without a front controller
- XAMPP Permission Denied for Require_Once Mac OS X Yosemite
- PHP require warning says "no such file" even though the warning traces out the correct file path
- php require_once not finding file with absolute path?
- Using PHP requires with varying directory levels
- WordPress site suspected of being compromised
- nested page cannot find parent .js file
Related Questions in INCLUDE-ONCE
- syntax error, unexpected end of file when using include_once('header.php')
- I am using include_once but still getting Cannot redeclare. I know the function exists, that is why I'm using include_once
- Why would PHP include_once succeed but require_once, on the same file, fail?
- How to solve the fatal error in require_once
- Error with PHP 5.6 to PHP 7.2.4. Include_once don´t work
- how to deal with include_once php urls?
- PHP include_once not working (have tried almost everything I've found)
- require/include throwing warning: no such file or directory in
- Wordpress - Include_once root files
- include_once failed to open stream and Warning: include_once(): Failed opening.for inclusion (include_path='.:/usr/share/pear:/usr/share/php')
- include_once not working when using in shell script
- Getting error when using a function defined inside a php-file from another php-file
- PHP - How does the `require_once` construct executes the code?
- include_once works in one page but not other, no errors with displaying_error on
- PHP - include_once/include not working
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
The require and include functions do the same task, the small difference is :
See : Click require and include
So you did not solve the problem, you've just transform the error level from ERROR to WARNING, that's why your script is working.