#21038 [Opn]: require & require_once probs

From: Date: Mon, 16 Dec 2002 08:45:34 +0000
Subject: #21038 [Opn]: require & require_once probs
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-27828@lists.php.net to get a copy of this message
ID: 21038 User updated by: hbaes@chiemgaudata.de Reported By: hbaes@chiemgaudata.de Status: Open Bug Type: *General Issues Operating System: Linux PHP Version: 4.3.0RC3 New Comment: Hi, here is the content: /home/www/web2/html/pdf/pc4p/ wirtz_pc4p.php /home/www/web2/html/pdf/pc4p/include pc4p_init.inc pc4p_main.inc pc4p_page.inc ... so the included files are a.) in the same file as the including file (pc4p_init.inc) and b.) inside the include_path (as listened in the error aoutput). I had this problem with another script, too, which used nasted require_once() commands (a kind of shop-engine). With 4.2.3 it works fine, but since 4.3.0RC3 the script got the same problem as the above pdflib-demo ... Previous Comments: ------------------------------------------------------------------------ [2002-12-16 02:26:57] tix@php.net Hi, as I can see the PHP script 'wirtz_pc4p.php' includes the file 'pc4p_init.inc' which is located in /home/www/web2/html/pdf/pc4p/include/. The file (pc4p_init.inc) includes other files (without suppling a path) which should be located in http://www.chiemgaudata.de/pdf/pc4p/ (because this is the current directory) or /home/www/web2/html/pdf/pc4p/include/ (because this is in the include path) Where is the file 'pc4p_main.inc' located? I tried to list the directory in http://www.chiemgaudata.de/pdf/pc4p, but this wasn't allowed. Greetings. ------------------------------------------------------------------------ [2002-12-16 02:11:23] hbaes@chiemgaudata.de Hi Rasmus, I´m sorry to say, but the include path (the path where this script resides ) is: /home/www/web2/html/pdf/pc4p/include like You can see. I downloaded the latest Snapshort and reinstalled it a few minutes ago, and I still have the same Probs with ALL my Scripts which use require .... It can´t be the include path, because if You look at the error output you can see, that the error-location file (init.inc) is in the include path. the files main.inc and page.inc stay in the same Directory :-( And: it´s NO difference if you use require_once("./main.inc"), require_once("main.inc"), require_once('main.inc') and so on ... The whole config-set in php.ini had been taken from my old 4.2.3. PS.: using php as Apache Dynamic .so lib ... mfG Harald (ps: test: www.cchiemgaudata.de/pdf/pc4p/wirtz_pc4p.php ) (orig example of pdflib ) ------------------------------------------------------------------------ [2002-12-16 02:02:34] rasmus@php.net Well, the difference between include and require is that require will throw a fatal when it can't find the file and include will just give you a warning. So, it sounds to me like your new install simply can't find the file in both cases and you are only seeing the fatal error message. Perhaps your include_path is set differently in this new install? ------------------------------------------------------------------------ [2002-12-16 01:19:27] hbaes@chiemgaudata.de since the update from 4.2.3 to 4.3.0RC3 I´ve found several scripts (i.e the pdflib-test-scripts) which have probs with require() and require_once() ! If I have a "master" include file with the following content: // Include the classes if ( !defined( "INC" ) ) { /** * Include the main object * */ require_once( "main.inc" ); /** * Include the page object * */ require_once( "page.inc" ); ... (main.inc and page.inc are in the same dir as the "master" include (/include) ..) I get following error when I run my script: Fatal error: main() [function.main]: Failed opening required 'main.inc' (include_path='.:/usr/local/lib/php:/home/www/web2/html/pdf/pc4p/include') in /home/www/web2/html/pdf/pc4p/include/init.inc on line 36 if i change the require_once to include_once then everything works fine .... best regards Harald ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=21038&edit=1

« previous php.bugs (#27828) next »