![]() |
Require, require_once, include and include_once not working correctly within hooks. - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Require, require_once, include and include_once not working correctly within hooks. (/showthread.php?tid=31845) |
Require, require_once, include and include_once not working correctly within hooks. - El Forum - 07-04-2010 [eluser]iancant[/eluser] I seem to be having an issue including or requiring a file from within a hook file. Code: if(file_exists('C:/wamp/www/park_factor_network/system/application/shared/config/language.php')) With this I get the following: Code: yes // result of file_exists() Operating System: Windows Vista Web Server Package: WAMP - Apache 2.2.11 - PHP 5.3.1 Code Igniter: Version 1.7.2 If I create a require outside of code igniter's environment and try to include a file it: a) works if the file exists b) Warning: require_once(File_Does_Not_Exist.php) [function.require-once]: failed to open stream: No such file or directory in C:\wamp\www\park_factor_network\shiter.php on line 3 Fatal error: require_once() [function.require]: Failed opening required 'File_Does_Not_Exist.php' (include_path='.;C:\php5\pear') in C:\wamp\www\park_factor_network\shiter.php on line 3 Require, require_once, include and include_once not working correctly within hooks. - El Forum - 07-04-2010 [eluser]WanWizard[/eluser] Safe mode enabled by any chance? Require, require_once, include and include_once not working correctly within hooks. - El Forum - 07-04-2010 [eluser]iancant[/eluser] No safe mode enabled. I can include and require elsewhere, and CI's own includes and requires work fine, it seems to be only within hooks, the problem occurs. Require, require_once, include and include_once not working correctly within hooks. - El Forum - 07-04-2010 [eluser]WanWizard[/eluser] Hmmm... Pretty sure that is not related. Hooks don't alter the way PHP works. What worries me is this: Code: Message: require_once(1) [function.require-once] Require, require_once, include and include_once not working correctly within hooks. - El Forum - 07-04-2010 [eluser]iancant[/eluser] Exactly, I would say its a php error but it only occurs within hooks files. It seems maybe that in this case php is having an issue resolving the files location? Has anyone had any issues with this before? Require, require_once, include and include_once not working correctly within hooks. - El Forum - 07-04-2010 [eluser]iancant[/eluser] Hi, Problem is solved, some very clever over on Stack Overflow came up with the answer, which in hindsight makes perfect sense. I have <a href="http://stackoverflow.com/questions/3175178/require-once-and-include-once-not-resolving-files-correctly"> linked here</a> as the answers are very interesting read for any new php developer. Thanks |