fopen -- bug or feature ?

From: Date: Thu, 12 Oct 2000 13:58:56 +0000
Subject: fopen -- bug or feature ?
Groups: php.qa 
Request: Send a blank email to php-qa+get-1488@lists.php.net to get a copy of this message
Hi ! Asumme the following script: <? echo pwd; $file = $argv[1]; $fd=fopen($fil, "r"); echo fread($fd, 10000); ?> and relative path for input parameter (e.g. ../Makefile) If I run it from the same directory as the scipt lies, it's ok. If I run it from a different directory it fails, since upon script start it changes current directory to the directory where script lies. This behaviour is very annoying since I must define absolute paths to have scripts in one, data files in second and makefile invocation point in third directory, but I'd like to have relative paths in makefile. Yes I know that I can use $(HOME) (i.e. absolute paths), but then I have very long command lines (asume all modules, libraries etc.) I tried to convert realtive path to absolute path in php program, but no luck. 'realpath' returns "" if the file does not exist. So it's uselless in this occasion. Some hints? Regards Matjaz begin 666 Matjaz Ostroversnik.vcf M0D5'24XZ5D-!4D0-"E9%4E-)3TXZ,BXQ#0I..D]S=')O=F5R<VYI:SM-871J M87H[.V1R+@T*1DXZ36%T:F%Z($]S=')O=F5R<VYI:PT*3DE#2TY!344Z;W-T M<FD-"D]21SI:879O9"!Z82!T<F%N<V9U>FEJ;R!K<G9I#0I414P[5T]22SM6 M3TE#13HK,S@V(#8Q(#$T(#,X(#(S- T*5$5,.TA/344[5D])0T4Z*S,X-B V M,2 Q-2 Y." V-3$-"D%$4CM73U)+.CL[4VQA:FUE<FIE=F$@-CM,:G5B;&IA M;F$[4VQO=F5N:6IA.S$P,# [4VQO=F5N:6$-"DQ!0D5,.U=/4DL[14Y#3T1) M3D<]455/5$5$+5!224Y404),13I3;&%J;65R:F5V82 V/3!$/3!!3&IU8FQJ M86YA+"!3;&]V96YI:F$@,3 P,#TP1#TP05-L;W9E;FEA#0I!1%([2$]-13H[ M.T]M97)S;W9A(#8Y.TQJ=6)L:F%N83L[,3 P,#M3;&]V96YI80T*3$%"14P[ M2$]-13M%3D-/1$E.1SU154]4140M4%))3E1!0DQ%.D]M97)S;W9A(#8Y/3!$ M/3!!3&IU8FQJ86YA(#$P,# ],$0],$%3;&]V96YI80T*6"U704(M1T5.1$52 M.C(-"E523#IH='1P.B\O=W=W+64R+FEJ<RYS:2]M871J87HN;W-T<F]V97)S M;FEK#0I54DPZ:'1T<#HO+W=W=RUE,BYI:G,N<VDO36%T:F%Z+D]S=')O=F5R M<VYI:PT*14U!24P[4%)%1CM)3E1%4DY%5#IM871J87HN;W-T<F]V97)S;FEK M0'IR<RUT:RYS:0T*4D56.C(P,# Q,#$R5#$S-3@U-EH-"D5.1#I60T%21 T* ` end

« previous php.qa (#1488) next »