#21649 [Opn->Fbk]: This this problem with fopen() function for windows

From: Date: Wed, 15 Jan 2003 20:29:17 +0000
Subject: #21649 [Opn->Fbk]: This this problem with fopen() function for windows
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-30173@lists.php.net to get a copy of this message
ID: 21649 Updated by: sniper@php.net Reported By: lipinski7722@rogers.com -Status: Open +Status: Feedback Bug Type: Filesystem function related Operating System: win2000 server PHP Version: 4.3.0 New Comment: You're using the 3rd param for fopen(), which says to look in the include path for the file, but you're still using the absolute path to it..what if you change it to plain 'authenticate.txt' ?? Previous Comments: ------------------------------------------------------------------------ [2003-01-15 10:58:22] lipinski7722@rogers.com Hi Sniper As You wish :)) This is what I got when I change a include_path as You suggested include_path .c:\php4\pear;c:\ .c:\php4\pear;c:\ look at 1.source <?php $fp = fopen("C:\\authenticate.txt","r",1); $auth_file = fread ($fp, filesize($fp)); fclose($fp); .... ?> 2.errors a) fopen() Warning: fopen(C:\authenticate.txt) [function.fopen]: failed to create stream: No such file or directory in C:\Program Files\Apache Group\Apache2\htdocs\authfile.php on line 3 Warning: fread(): supplied argument is not a valid stream resource in C:\Program Files\Apache Group\Apache2\htdocs\authfile.php on line 4 Warning: fclose(): supplied argument is not a valid stream resource in C:\Program Files\Apache Group\Apache2\htdocs\authfile.php on line 5 b) Pear db Warning: main(DB.php) [function.main]: failed to create stream: No such file or directory in C:\Program Files\Apache Group\Apache2\htdocs\login_db.php on line 2 Fatal error: main() [function.main]: Failed opening required 'DB.php' (include_path='.c:\php4\pear;c:\') in C:\Program Files\Apache Group\Apache2\htdocs\login_db.php on line 2 be more systematic :)) :)) I say changing the path in php.ini doesn't do the trick I change it back to include_path="c:\php4\pear;c:\php4\php-4.3.0-Win32" and put my authenticate.txt afert kicking Apache I got from phpinfo() include_path c:\php4\pear;c:\php4\php-4.3.0-Win32 c:\php4\pear;c:\php4\php-4.3.0-Win32 read this portion and I need an anser please no more guess $fp = fopen("C:\\php4\\php-4.3.0-Win32\\authenticate.txt","r",1); $auth_file = fread ($fp, filesize($fp)); fclose($fp); Now I got Pear DB working and same error with fopen() this is a print out Warning: fopen(C:\php4\php-4.3.0-Win32\authenticate.txt) [function.fopen]: failed to create stream: No such file or directory in C:\Program Files\Apache Group\Apache2\htdocs\authfile.php on line 3 Warning: fread(): supplied argument is not a valid stream resource in C:\Program Files\Apache Group\Apache2\htdocs\authfile.php on line 4 Warning: fclose(): supplied argument I hope this will help You Best Regards W.J.Lipinski ------------------------------------------------------------------------ [2003-01-15 09:30:54] sniper@php.net Please use the 'Edit Submission' page when you edit your own bug reports. And does your example work with the ".;c:\php4\pear;c:\" as include_path ? And what error does the PEAR Db give then? ------------------------------------------------------------------------ [2003-01-15 08:36:00] lipinski7722@rogers.com Hi I just change a line in php.ini include_path="c:\php4\pear;c:" when I run after I restarted Apache 2 <?php phpinfo();?> it shows include_path c:\php4\pear;c: c:\php4\pear;c: Warning: fopen(C:\authenticate.txt) [function.fopen]: failed to create stream: No such file or directory in C:\Program Files\Apache Group\Apache2\htdocs\authfile.php on line 3 Warning: fread(): supplied argument is not a valid stream resource in C:\Program Files\Apache Group\Apache2\htdocs\authfile.php on line 4 Same error ??? Best Regards W.J.Lipinski ------------------------------------------------------------------------ [2003-01-15 07:33:58] lipinski7722@rogers.com Hi Sniper ; Windows: "\path1;\path2" ; include_path = ".;c:\php4\includes" ; include_path=".;c:\php4\pear" include_path="c:\php4\pear;c:\" Please notice when I change path to ".;c:\php4\pear;c:\ Pear DB is complaining that cannot find what needed. Onother story is that when You comment these line So You shoudn't see any lines.Isn't that strange .;c:\php4\pear this is being shown from <?php phpinfo();?> How include_path could be hardcoded???????? Best Regards W.J.Lipinski ------------------------------------------------------------------------ [2003-01-15 03:10:40] sniper@php.net What is the exact include_path line in your php.ini? ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/21649 -- Edit this bug report at http://bugs.php.net/?id=21649&edit=1

« previous php.bugs (#30173) next »