[PHP-DEV] CVS Account Request: gui
I'd like a CVS account to contribute to : - the french translation of phpdoc ( working at nexen.net, I have the agreement of [EMAIL PROTECTED] - He told me to request this account) - the french translation of peardoc -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Reducing the number of system calls for includes
Weird. That was totally contrary to the way I remember it working. In trying to figure out why I remembered incorrectly, I realized the reason why you (in general) want to resolve the path to a canonical path is that you can seriously break include_once and require_once if you dont. Otherwise require_once wont correctly work if you do ? require_once(/home/george/foo.php); require_once(/home/george/../george/foo.php); ? Right, but guarding against this edge case is costing us a lot on the normal case. 100,000 realpath() calls on Linux on file /home/rasmus/foo/u2.inc: real0m1.286s user0m0.190s sys 0m1.030s 100,000 stat() calls on Linux on file /home/rasmus/foo/u2.inc: real0m0.421s user0m0.070s sys 0m0.290s The deeper the directory hierachy, the larger the difference. On FreeBSD we get slammed! Looks like they don't have the same dcache-like thing that Linux has. 100,000 realpath() calls on /home/rasmus/foo/u2.inc on FreeBSD: real0m51.274s user0m6.752s sys 0m26.478s 100,000 stats() calls on the same file on FreeBSD: real0m8.873s user0m0.165s sys 0m8.042s So yes, it does look like we don't need to worry too much on Linux, but clearly on FreeBSD avoiding stat() calls and calls that create cascading stat()'s are to be avoided at all costs. -Rasmus -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] If... Else.. I'm not getting it!
Hi all, Please can you help me with the following: If got a little sample code: This one is working (!): ?php $vname=$_POST['vname']; echo hello $vname; ? form action=? echo ($_SERVER['PHP_SELF']); ? method=post table trtdInput yourname/tdtdinput type=text name=vname/td/tr trtd colspan=2input type=submit name=submit/td/tr /table /form ?php ? But when i'm using IF Else.. Nothing is happening. I'm only seeing the form but when i submit that form: The $vname doen't display.. Here is the code that doesn't work: ?php $vname=$_POST['vname']; if($submit) { echo hello $vname; } else { ? form action=? echo ($_SERVER['PHP_SELF']); ? method=post table trtdInput yourname/tdtdinput type=text name=vname/td/tr trtd colspan=2input type=submit name=submit/td/tr /table /form ?php } ? What am I doing wrong??? Thanks, Frank
[PHP-DEV] If... Else.. I'm not getting it!
Hi all, Please can you help me with the following: If got a little sample code: This one is working (!): ?php $vname=$_POST['vname']; echo hello $vname; ? form action=? echo ($_SERVER['PHP_SELF']); ? method=post table trtdInput yourname/tdtdinput type=text name=vname/td/tr trtd colspan=2input type=submit name=submit/td/tr /table /form ?php ? But when i'm using IF Else.. Nothing is happening. I'm only seeing the form but when i submit that form: The $vname doen't display.. Here is the code that doesn't work: ?php $vname=$_POST['vname']; if($submit) { echo hello $vname; } else { ? form action=? echo ($_SERVER['PHP_SELF']); ? method=post table trtdInput yourname/tdtdinput type=text name=vname/td/tr trtd colspan=2input type=submit name=submit/td/tr /table /form ?php } ? What am I doing wrong??? Thanks, Frank
Re: [PHP-DEV] Reducing the number of system calls for includes
At 04:51 PM 1/24/2003 -0800, Rasmus Lerdorf wrote: Which broken systems? Certainly not on FreeBSD or Linux. A little test: stat(/home/rasmus/foo/u2.inc,sb); That ends up doing just a single stat on FreeBSD: stat(/home/rasmus/foo/u2.inc,0x9fbffa0c) = 0 (0x0) and on Linux: stat64(/home/rasmus/foo/u2.inc, {st_mode=S_IFREG|0644, st_size=12, ...}) = 0 Yes you are right. But I still think the advantages of having a canonical file path is good. It improves error messages, it allows for open_basedir and include_once() to work 100%. I don't think it's worth killing good stable functionality for this. What needs to be taken from your timings is not the relative time of stat() vs. realpath() but the absolute times. You can see that on Linux the speed of realpath() is 12 microsecond. I don't believe you can feel this in a script even if you have tens of realpath()'s per script (at least vs. stat()). Now on FreeBSD it takes about half a millisecond. That is much more but I'm not sure it's still worth breaking functionality for this. That said, we could possibly have a fast mode and use fstat() to get some device information on the open file. I am worried about functionality though. I'm not sure it's worth breaking. Andi -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Reducing the number of system calls for includes
That said, we could possibly have a fast mode and use fstat() to get some device information on the open file. I am worried about functionality though. I'm not sure it's worth breaking. Yes, fstat() is fast. And perhaps it isn't worth breaking functionality across the board, but in my particular case I don't really have a choice. It is simply too slow to handle the loads that it needs to handle and either I need to get twice as many machines or I need to lose some functionality. Another idea would be to try to streamline the normal case for an absolute pathname. How about doing a readlink() on it. If that tells us that it is a link, then we know there is something funky and we can do a realpath, otherwise we just assume it is canonical assuming there are no . .. or // in the filename in which case we fall back to a realpath() as well. Or, the really straightforward dumbass solution, have some hint we can pass along that tells the parser to treat what follows as a canonical filename. include \001/home/rasmus/foo/u2.inc; A bit too hacky I guess. Perhaps something like: include_canonical /home/rasmus/foo/u2.inc; And we would simply assume that this is a canonical filename and skip all the checks. This last one is probably what I will need to do, but I will do some tests on the readlink() optimization and see if that buys me anything. -Rasmus -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DEV] Reducing the number of system calls for includes
-Original Message- From: George Schlossnagle [mailto:[EMAIL PROTECTED]] Sent: Saturday, January 25, 2003 5:28 AM To: Rasmus Lerdorf Cc: [EMAIL PROTECTED] Subject: Re: [PHP-DEV] Reducing the number of system calls for includes On Friday, January 24, 2003, at 10:19 PM, Rasmus Lerdorf wrote: Weird. That was totally contrary to the way I remember it working. In trying to figure out why I remembered incorrectly, I realized the reason why you (in general) want to resolve the path to a canonical path is that you can seriously break include_once and require_once if you dont. Otherwise require_once wont correctly work if you do ? require_once(/home/george/foo.php); require_once(/home/george/../george/foo.php); ? (of course you can put together a less contrived example). Yeah, we had the same problem in PEAR. And that is why we added set_include_path to make it possible for people to keep their own little repository of PEAR apps and still ensuring that they don't use different relative include paths. I was really not happy with the solution at the time. Because that means that I either have to fix all the PEAR apps that I bundle with my application to not use the expensive include_path or accept the performance hit. Regards, Lukas -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Reducing the number of system calls for includes
The question here is whether it's worthwhile to optimize for the case where you have 30+ includes per page. Is it that common? In my particular case just 2 or 3 includes puts me over the top actually. stat() is amazingly slow on freebsd and having 3 includes of files in a directory 8 levels below the root is going to do 27 stat()'s. 27 stats on my freebsd box here takes 24ms to execute. That's a long time to be sitting around stat'ing things. And heaven help me if the path is not absolute and I have to try different include paths. And if open_basedir is also enabled you might as well go for a coffee while you wait through some 80+ syscalls for every include. -Rasmus -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Reducing the number of system calls for includes
At 02:30 AM 1/25/2003 -0800, Rasmus Lerdorf wrote: That said, we could possibly have a fast mode and use fstat() to get some device information on the open file. I am worried about functionality though. I'm not sure it's worth breaking. Yes, fstat() is fast. And perhaps it isn't worth breaking functionality across the board, but in my particular case I don't really have a choice. It is simply too slow to handle the loads that it needs to handle and either I need to get twice as many machines or I need to lose some functionality. Another idea would be to try to streamline the normal case for an absolute pathname. How about doing a readlink() on it. If that tells us that it is a link, then we know there is something funky and we can do a realpath, otherwise we just assume it is canonical assuming there are no . .. or // in the filename in which case we fall back to a realpath() as well. Hmm I'm not sure this would give you what you're looking for. I think it only works if the last element of the path is a symbolic link but I might be wrong. I'm not quite sure of the semantics of readlink(). Or, the really straightforward dumbass solution, have some hint we can pass along that tells the parser to treat what follows as a canonical filename. include \001/home/rasmus/foo/u2.inc; A bit too hacky I guess. Perhaps something like: include_canonical /home/rasmus/foo/u2.inc; And we would simply assume that this is a canonical filename and skip all the checks. This last one is probably what I will need to do, but I will do some tests on the readlink() optimization and see if that buys me anything. I think both of these solutions are too hacky. If we end up deciding that it makes sense to have a mode which uses fstat() then we should probably just document what we believe could break and with a use this with care! warning. I'm going to try and think if there are other options which won't break functionality. Andi -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Reducing the number of system calls for includes
That said, we could possibly have a fast mode and use fstat() to get some device information on the open file. I am worried about functionality though. I'm not sure it's worth breaking. The question here is whether it's worthwhile to optimize for the case where you have 30+ includes per page. Is it that common? Yes, I'm as a PHP-developer (developing _with_ PHP :-), I can say, my site has a well-organized dir-structure, I uses a _lot_ of includes, in some requests, it's over 30 (it's depends on the request, because i use a main script as a wrapper for other scripts..) I think that sites where this actually matters should employ some form of preprocessing for their scripts where include/require directives get interpolated by the contents of the respective file. This can be easily implemented either in about 50 LOC of PHP or sh/awk. That won't work of course, if you rely heavily on dynamic includes where the filename is determined at run-time. WKO preprocessing do you think? Miham. -- * * Miham KEREKES * Szegedi Tudomnyegyetem Egyetemi Knyvtr * *[ [EMAIL PROTECTED] ]** * Aki mindig a stor tetejn van, annak a storaljajhely.. * -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] PHP 4 Bug Summary Report
PHP 4 Bug Database summary - http://bugs.php.net Num Status Summary (1096 total including feature requests) ===[*Configuration Issues] 13561 Assigned --without-pear prevent install of php-config,phpize,... 19282 Wont fix Place php4ts.dll into \sapi 20490 Analyzed enable versioning not supported on OSX 20689 Wont fix php_admin_value disable_functions not working as it should 21161 Open ./configure doesn't work with xslt support 21195 Verified Configure warnings/errors 21216 Wont fix phpize passes --no-verify to ltconfig without specifying host ===[*Database Functions]== 21549 Feedback problem with INGRES II permanent connexions ===[*Directory/Filesystem functions] 21310 Open no such file (paths) 21532 Open incorrect warning 21597 Feedback Glob doesn't seem to work as expected 21629 Feedback very strange bug happens only once in a while 21713 Assigned include (URL) doesn't remove temporary files ===[*General Issues]== 20195 Open make install doesnt set permissions 20775 Open Silent install (/s) does not work 20896 Verified php -w hangs indefinitely at 100% CPU 20946 Suspended php_ingres.dll missing in the php 4 zip!!! 21254 Wont fix Suggestion for the site 21281 Feedback False Line output 21559 Feedback Fatal error: Nesting level too deep - recursive dependency? in Unknown on line 21647 Feedback make test gives loop error 21696 Feedback Checkbox is strange in POST event 21749 Feedback webmail ( squirrelmail 1.2.10 21861 Feedback set_time_limit does not Limit the maximum execution time with safe_mode off 21870 Open Core Predefinded with wrong paths ===[*Languages/Translation]=== 11975 Wont fix mix of hebrew english 13014 Wont fix hebrevc () 20166 Feedback Unicode (Slovenian) characters are not displayed correctly ===[*Math Functions]== 21534 Open GMP lib gmp_gcdext() gives incorrect results 21628 Feedback decimal numbers without decimal places ===[*Network Functions]=== 15639 Suspended detecting end of UDP packets ===[*Programming Data Structures]= 21062 Wont fix Recursive calls may SEGV ===[*URL Functions]=== 21674 Feedback Warning: main(lang.php) [function.main]: failed to create stream: No such file ===[Apache related]=== 14409 Open request for nonexistent file does not return 404 error 15529 Open ap_cleanup_for_exec not used when creating 17837 Wont fix PHP 'handles' permission problems rather than letting Apache do it 19113 Open HTTP status 200 returned on HTTP CONNECT when mod_proxy not in use 19292 Critical random error: open_basedir restriction in effect. File is in wrong directory 20190 Critical Random mem corruption: zend_get_executed_filename() mismatch 20551 Feedback Output compression causes segfaults (ob_gzhandler) 20665 Wont fix Memory leaks on SIGHUP 21056 Open PHP messes with virtual hosts 21568 Feedback The memory could not be read. 21675 Open Relative includes and Apache Alias problem 21864 Feedback Apache 1.3.27 core dumps when PHP 4.3.0 is activated via LoadModule ===[Apache2 related]== 17414 Open Segfaults on restart 17868 Verified Doesn't work two and more !--include-- directives of PHP code on different OS 18359 Open PHP module seem to make trouble with authentication under Apache 2 18648 Open Single entry form POST gives incorrect variable content 18957 Wont fixmultiple definitions 19618 Suspended Cannot load libphp4.so - Win32 error 5 19787 Wont fix Can not load module 20929 Open Problem in handling big5 characters from HTML form 21040 Open max_execution_time ignored 21074 Open PHP doesn't work with 401 (Auth) ErrorDocument and Apache2 21084 Open Undefined symbol ___guard in libphp4.so 21283 Open Apache2 PHP4.3 leak memory when respond to requests 21452 Feedback Apache dumps core inside php code 21683 Open Creation of libphp4.so not possible 21819 Open Corrupted uploaded binary files 21858 Feedback apache uses %100 prosessor ===[Arrays related]=== 18829 Wont fix array_pop, array_shift, array_push... functions very slow with large arrays 20251 Wont fix Can't assign values to array in loop. 21788 Open array_multisort() changes array keys unexpectedly given numeric strings as keys ===[BC math
Re: [PHP-DEV] Reducing the number of system calls for includes
I like this solution. On Saturday, January 25, 2003, at 09:08 AM, Andi Gutmans wrote: Hi, I think the best solution to this problem, without breaking functionality, is to use a cache for realpath() in virtual_file_ex(). -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Reducing the number of system calls for includes
I think the best solution to this problem, without breaking functionality, is to use a cache for realpath() in virtual_file_ex(). This should solve the performance problems and not effect BC at all. As TSRM always passes a full path to the realpath() call there, it should always work. Perhaps make it configurable because on Linux there already is a dcache right in the kernel which is likely to be faster than anything we can do. As far as I know, Linux is the only OS with such a kernel-level cache. -Rasmus -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] Adding to the bundled GDlib
Hi list. I want to gratulate you for finally including the GDlib as a bundled extension to PHP and recognize that the Boutell people has apparently stalled the development... Now it also seems like new PHP/GD-only functions are sneaking in (there is a imagelayereffect and imagecolormatch function added) and that is even better! I have now played around with GD for the last few days and added around 10+ new vital functions which are must-haves for what must be tons of people needing a truely powerful graphics manipulation engine. I'll tell you more about those functions and demonstrating them by a demo-website soon. But my actual request is this: - Who is in charge of the bundled GD? (Who can I discuss it with) - What is the policy on that library? Do you want it to be expanded with new functions? - Would you be positive towards additions from me? (I want to know this before I spend more brainpower) - How can I help? (I'm new to this list but is a very experienced PHP programmer since PHP/FI 2) I really want to help the development of the bundled GD to be a powerful image manipulation package. For now my changes are simply additions and I'm going to supply full documentation of the API and possibly also offer a public testsite for the demonstration. If that is at all appreciated, please let me know. - kasper -- Attitude dude! - Don't rebrand TYPO3! -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] win32 builtin zlib
Hi, I rewrote the part in the phpdoc manual about building on windows. zlib is builtin with 4.3.0 but the shipped Workspace for VC++ relies on a precompilded external zlib.lib. Therefore building on win32, out of the box, is not possible without downloading zlib sources, compiling them and either modify the workspace or figure out where to place zlib.lib. Two points: 1.) In the released 4.3.0 source dist, the workspace points to ../../zlib, 2.) for example snapshot php4-STABLE-200301241430 points to ../../zlib/Release This is hard to document 1.) Are there future plans to include the zlib sources? 2.) Should users be advised to modify config.win32.h.in 3.) Should users be advised to download zlib sources, building zlib.lib? Thanks for any thoughts, suggestions, corrections Regards Friedhelm Betz -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] win32 builtin zlib
At 19:59 25/01/2003, Friedhelm Betz wrote: Hi, I rewrote the part in the phpdoc manual about building on windows. zlib is builtin with 4.3.0 but the shipped Workspace for VC++ relies on a precompilded external zlib.lib. Therefore building on win32, out of the box, is not possible without downloading zlib sources, compiling them and either modify the workspace or figure out where to place zlib.lib. Two points: 1.) In the released 4.3.0 source dist, the workspace points to ../../zlib, 2.) for example snapshot php4-STABLE-200301241430 points to ../../zlib/Release This is hard to document 1.) Are there future plans to include the zlib sources? No. zlib is included in a similar way to the way we include bindlib_w32. It's in a different repository on cvs.php.net, that we expect to be checked out and built by the time you build PHP. 2.) Should users be advised to modify config.win32.h.in Nope (this particular file doesn't exist anymore, btw) 3.) Should users be advised to download zlib sources, building zlib.lib? Not sure - I think that zlib should be in the win32build.zip archive. If you put it where bindlib_w32.lib is, we should be fine :) Zeev -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] Practical question
Hi, Well, I know, this list is not for aiding users developing _with_ PHP but for developing _the_ PHP, but I think, this is the best place for this question -- correct me if I'm wrong. I'm creating a site which is quite an extensive, you know, I mean great, well-organized directory structure, etc.. As I always think, if the scriptfile is growing above 10k, i should split that into two or more files if the functions are alternative, in order to save some CPU cycles by not to process the whole file in vain. But as I recently red, the require takes up a LOT of CPU cycles. So, my question finally is: What is that filesize, above which is _recommended_ to split files into parts? Thanks, Miham. -- * * Miham KEREKES * Szegedi Tudomnyegyetem Egyetemi Knyvtr * *[ [EMAIL PROTECTED] ]** -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Practical question
On Sat, 2003-01-25 at 15:52, Miham KEREKES wrote: Hi, Well, I know, this list is not for aiding users developing _with_ PHP but for developing _the_ PHP, but I think, this is the best place for this question -- correct me if I'm wrong. you're wrong. ask this question on [EMAIL PROTECTED] -Sterling -- Programming today is a race between software engineers stirring to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning. - Unknown -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Reducing the number of system calls for includes
Perhaps make it configurable because on Linux there already is a dcache right in the kernel which is likely to be faster than anything we can do. On linux you still have to make all those stat calls (they just return fast). A hashlookup inside TSRM will almost certainly return much faster. As far as I know, Linux is the only OS with such a kernel-level cache. Isn't solaris' dnlc similar in function to linux's dcache? -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] If... Else.. I'm not getting it!
On Sat, 25 Jan 2003 10:12:56 +0100 Frank Keessen [EMAIL PROTECTED] wrote: ?php $vname=$_POST['vname']; if($submit) { if you would have sent this message to [EMAIL PROTECTED] you would be then instantly explained that $submit should have been $_POST['submit'] in you code. Please ask yoiur questions from now on to [EMAIL PROTECTED] - this list is for developing PHP itself. -- Maxim Maletsky [EMAIL PROTECTED] -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] win32 builtin zlib
Saturday, January 25, 2003, Zeev Suraski wrote: 1.) Are there future plans to include the zlib sources? No. zlib is included in a similar way to the way we include bindlib_w32. It's in a different repository on cvs.php.net, that we expect to be checked out and built by the time you build PHP. Ok, from users point the same... Maybe my question was a bit misleading, I meant provided within win32build.zip, maybe. 2.) Should users be advised to modify config.win32.h.in Nope (this particular file doesn't exist anymore, btw) Hm, you are right, at least not in the snapshots, but in the official release 4.3.0 from php.net... anyway. 3.) Should users be advised to download zlib sources, building zlib.lib? Not sure - I think that zlib should be in the win32build.zip archive. Nope;-) As zlib is builtin and the workspaces rely on, it would be really nice for users if they are done by downloading php4.xxx.tar.gz, win32build.zip and bindlib_w32.zip, the way like other standard builtin modules are fine with. So what would be the offical advise from php.net showing up in the manual? Checking out zlib from cvs? Where to place, so that the workspaces shipped with releases from php.net working out of the box? Regards Friedhelm Betz -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] win32 builtin zlib
On Sat, 25 Jan 2003 18:59:37 +0100 Friedhelm Betz [EMAIL PROTECTED] wrote: Hi, I rewrote the part in the phpdoc manual about building on windows. zlib is builtin with 4.3.0 but the shipped Workspace for VC++ relies on a precompilded external zlib.lib. This is just what I run into a few hours ago trying to build php5 checkout with VC6. Therefore building on win32, out of the box, is not possible without downloading zlib sources, compiling them and either modify the workspace or figure out where to place zlib.lib. I had to download zlib.lib from w3c.org before building (here: http://dev.w3.org/cvsweb/libwww/Library/External/zlib.lib?sortby=file) Two points: 1.) In the released 4.3.0 source dist, the workspace points to ../../zlib, 2.) for example snapshot php4-STABLE-200301241430 points to ../../zlib/Release This is hard to document 1.) Are there future plans to include the zlib sources? probably the quickiest way, unless there are some problems with it, not really sure. 2.) Should users be advised to modify config.win32.h.in This would mean that every distribution would have to be modified beforeit is built for win32, not the best way IMO. 3.) Should users be advised to download zlib sources, building zlib.lib? The link above from w3c could be a good idea to point the user to. -- Maxim Maletsky [EMAIL PROTECTED] -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] Re: [PHP-DOC] Re: [PHP-DEV] win32 builtin zlib
On Sat, 25 Jan 2003 23:39:36 +0100 Friedhelm Betz [EMAIL PROTECTED] wrote: [...] The link above from w3c could be a good idea to point the user to. Sure, but not a very smart solution IMHO ;-). It think it should be possible (and preferable) to bundle the required whatever files with win32build.zip ;-) I completely agree. I didn't know about the win32build.zip untill Zeev mentioned it. --- Maxim Maletsky [EMAIL PROTECTED] -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] php_stream size
At the moment, what you are currently doing is one of the simplest ways of doing it portably, provided that the stream is seekable. The other way is to call php_stream_stat() which returns the size, ctime, mtime etc. of the stream, and can theoretically work on virtual filesystems and wrappers (if those things implement the stat op, that is!). This is perhaps a better solution because the HTTP wrapper could (but does not yet) provide the Content-Length information in the size field of the stat structure (of course, the remote server might not send a Content-Length header, so no size information would be present). At the end of the day, the correct solution for your code depends on what your code is trying to do; not all streams are seekable, so the stat option is better, but then, stat is not guaranteed to return a sensible size (or even any information). If you are working on the stream in read-only operation, you can open the stream using the STREAM_MUST_SEEK flag; this will cause the streams layer to determine if the stream is seeekable; if it is not, it will copy the stream into a temporary stream which is seekable. (The temp stream is implemented as a memory buffer when the data are below a certain threshold; when it gets too big for memory, it will automatically use a temporary file for storage). So you will be guaranteed that seek (and stat) will work on the stream, but not guaranteed to be working with the actual resource you requested. (Hence the reason that it is not suitable for read/write mode). I hope that has helped! --Wez. On Sat, 25 Jan 2003, l0t3k wrote: wez, what's the most portable way to get the size of a stream ? right now im using stream = php_stream_open_wrapper ( path, mode, options, opened); php_stream_seek ( stream, SEEK_END, SEEK_CUR); size = php_stream_tell(stream); note that i have to also process the files, so i rewind immediately afterwards. for the moment, this is ok since im currently only using file-based streams. but i'd like to be able to be as generic as possible. l0t3k ps. would it make sense to have a get_size stream op ? -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] win32 builtin zlib
At 00:25 26/01/2003, Friedhelm Betz wrote: Saturday, January 25, 2003, Zeev Suraski wrote: 1.) Are there future plans to include the zlib sources? No. zlib is included in a similar way to the way we include bindlib_w32. It's in a different repository on cvs.php.net, that we expect to be checked out and built by the time you build PHP. Ok, from users point the same... Maybe my question was a bit misleading, I meant provided within win32build.zip, maybe. 2.) Should users be advised to modify config.win32.h.in Nope (this particular file doesn't exist anymore, btw) Hm, you are right, at least not in the snapshots, but in the official release 4.3.0 from php.net... anyway. 3.) Should users be advised to download zlib sources, building zlib.lib? Not sure - I think that zlib should be in the win32build.zip archive. Nope;-) As zlib is builtin and the workspaces rely on, it would be really nice for users if they are done by downloading php4.xxx.tar.gz, win32build.zip and bindlib_w32.zip, the way like other standard builtin modules are fine with. I'm not really following. I have to admit I never built PHP from the pre-made library binaries, so it sounds awkward to me. Are we making people download the bindlib source and build it? If so, we should do the same with zlib (looking into it, I guess it means creating a zlib.zip file, like bindlib_w32.zip). zlib and bindlib sit in exactly the same level of integration with PHP. To me it sounds a bit weird that the ready-made builds of these libraries don't come bundled in win32build.zip, but I guess that's fine as long as it's documented. Zeev -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php