php-general Digest 7 Aug 2008 09:01:10 -0000 Issue 5611
php-general Digest 7 Aug 2008 09:01:10 - Issue 5611 Topics (messages 28 through 277800): [scalability, performance, DoS] To or not to process images at runtime 28 by: Marcelo de Moraes Serpa 277792 by: Per Jessen 277793 by: Nathan Nobbe 277796 by: Per Jessen 277798 by: Marcelo de Moraes Serpa 277799 by: Per Jessen Re: Version Control Software 29 by: Waynn Lue 277781 by: Shawn McKenzie 277785 by: Colin Guthrie 277786 by: Ross McKay 277789 by: Robert Cummings Re: Variable number of parameters 277780 by: Shawn McKenzie Re: PHP Brain Teasers 277782 by: tedd Re: An appeal to your better nature 277783 by: Børge Holen 277787 by: Shawn McKenzie 277788 by: Robert Cummings 277794 by: Yeti Uploading Large Files - Strange Issue 277784 by: Anna Vester 277790 by: Jay Blanchard 277791 by: Anna Vester php File upload 277795 by: Tom 277800 by: Per Jessen Anyone use FileMaker 277797 by: Micah Gersten Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: [EMAIL PROTECTED] -- ---BeginMessage--- Hello, My next project will be a kind of online photo viewer. All of these photos will need to have watermark applied to them. The problem is that, depending on the picture, different watermarks need to be applied. The easiest solution would be to process these picture at runtime using GD, apply the watermark(s) and serve them. The other approach, would be to pre-process them (maybe using GD) and create different copies on the disk, the obvious advantage being that it could be served directly via the webserver (apache), but, it would be much harder to manage (need to fix a watermark error? Re-process and re-create the images on the disk...) and would take much more disk space. I would rather process them at runtime, per request, however, this site will probably have lots of traffic. So, I've reached a deadend. Could someone share his/her experiences and thoughts and help me decide? :) FYI, The application would be custom built from the ground up using PHP 5 (Not sure if we will use a framework, if we happen to use, it will be probably CakePHP). At first, there would be no clusters, proxies or balancers, just a plain dedicated server with a good CPU, about 4GB RAM and lots of disk space. PS: I've put DoS in the subject tagline meaning Denial of Service as I think that maybe dynamic processing of images X lots of request could result in DoS. Thanks in advance, Marcelo. ---End Message--- ---BeginMessage--- Marcelo de Moraes Serpa wrote: My next project will be a kind of online photo viewer. All of these photos will need to have watermark applied to them. The problem is that, depending on the picture, different watermarks need to be applied. The easiest solution would be to process these picture at runtime using GD, apply the watermark(s) and serve them. The other approach, would be to pre-process them (maybe using GD) and create different copies on the disk, the obvious advantage being that it could be served directly via the webserver (apache), but, it would be much harder to manage (need to fix a watermark error? Re-process and re-create the images on the disk...) and would take much more disk space. I would rather process them at runtime, per request, however, this site will probably have lots of traffic. So, I've reached a deadend. Could someone share his/her experiences and thoughts and help me decide? :) I think it depends on the amount of traffic you expect - high - off-line low-to-medium - on-line, on-demand, but cached. Disk-space is cheap, especially if you don't need to be worried about backup etc. I'm not sure why you think applying watermarks in an off-line process would any less manageable than doing it on-line. FYI, The application would be custom built from the ground up using PHP 5 (Not sure if we will use a framework, if we happen to use, it will be probably CakePHP). At first, there would be no clusters, proxies or balancers, just a plain dedicated server with a good CPU, about 4GB RAM and lots of disk space. Sounds like you are planning to do the processing off-line then. You could even do a mix - if you've got a lot of photos (millions and milloins), applying the watermarks could take a while in itself, so you could leave that running slowly in the background, but combine it with an on-line process that does on-demand watermarking (when the photo is displayed). /Per Jessen, Zürich ---End Message--- ---BeginMessage--- On Wed, Aug 6, 2008 at 3:04 PM, Marcelo de Moraes Serpa [EMAIL PROTECTED] wrote: Hello, My next project will be a kind of online photo viewer. All of these
Re: [PHP] [scalability, performance, DoS] To or not to process images at runtime
Marcelo de Moraes Serpa wrote: My next project will be a kind of online photo viewer. All of these photos will need to have watermark applied to them. The problem is that, depending on the picture, different watermarks need to be applied. The easiest solution would be to process these picture at runtime using GD, apply the watermark(s) and serve them. The other approach, would be to pre-process them (maybe using GD) and create different copies on the disk, the obvious advantage being that it could be served directly via the webserver (apache), but, it would be much harder to manage (need to fix a watermark error? Re-process and re-create the images on the disk...) and would take much more disk space. I would rather process them at runtime, per request, however, this site will probably have lots of traffic. So, I've reached a deadend. Could someone share his/her experiences and thoughts and help me decide? :) I think it depends on the amount of traffic you expect - high - off-line low-to-medium - on-line, on-demand, but cached. Disk-space is cheap, especially if you don't need to be worried about backup etc. I'm not sure why you think applying watermarks in an off-line process would any less manageable than doing it on-line. FYI, The application would be custom built from the ground up using PHP 5 (Not sure if we will use a framework, if we happen to use, it will be probably CakePHP). At first, there would be no clusters, proxies or balancers, just a plain dedicated server with a good CPU, about 4GB RAM and lots of disk space. Sounds like you are planning to do the processing off-line then. You could even do a mix - if you've got a lot of photos (millions and milloins), applying the watermarks could take a while in itself, so you could leave that running slowly in the background, but combine it with an on-line process that does on-demand watermarking (when the photo is displayed). /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] [scalability, performance, DoS] To or not to process images at runtime
On Wed, Aug 6, 2008 at 3:04 PM, Marcelo de Moraes Serpa [EMAIL PROTECTED] wrote: Hello, My next project will be a kind of online photo viewer. All of these photos will need to have watermark applied to them. The problem is that, depending on the picture, different watermarks need to be applied. The easiest solution would be to process these picture at runtime using GD, apply the watermark(s) and serve them. The other approach, would be to pre-process them (maybe using GD) and create different copies on the disk, the obvious advantage being that it could be served directly via the webserver (apache), but, it would be much harder to manage (need to fix a watermark error? Re-process and re-create the images on the disk...) and would take much more disk space. I would rather process them at runtime, per request, however, this site will probably have lots of traffic. So, I've reached a deadend. Could someone share his/her experiences and thoughts and help me decide? :) FYI, The application would be custom built from the ground up using PHP 5 (Not sure if we will use a framework, if we happen to use, it will be probably CakePHP). At first, there would be no clusters, proxies or balancers, just a plain dedicated server with a good CPU, about 4GB RAM and lots of disk space. PS: I've put DoS in the subject tagline meaning Denial of Service as I think that maybe dynamic processing of images X lots of request could result in DoS. for the code that will invoke the watermarking, put it behind another layer, so that you can easily alter it in the future as the site grows. for example, you might use strategy pattern, and your initial strategy will use the current webserver directly. however, as the site begins to grow, you can add additional webservers, dedicated to running gd on top of php. you can then write a strategy which will pass the requests off to those boxe(s), and it will be transparent to your existing code that knows only of the strategy interface. also, as you grow, distributed filesystems are key. for example, your front-end webserver can handle requests from users on the site, dispatch a request (restful for instance) to another box, dedicated to gd. since both boxes share a common filesystem via nfs (or other) the gd box can create the watermark, which will then be immediately available to the front-end box, which it could signal w/ another request to say 'hey, the watermark is ready'. -nathan
Re: [PHP] An appeal to your better nature
Backups? What's that? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php File upload
Hi, on a linux system (Suese 10.2) with 1 GB memory its not possible to upload via http a 1 Gb File. Thats no limit problem on my php config. i can look the mem stats when uploading and the growing tmp file. If the temp file has 900 MB, Main Memory free is 0 and the script aborts and php deletes the tmp file. Why don't php use swap memory ? Greets Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] [scalability, performance, DoS] To or not to process images at runtime
Bernhard Kohl wrote: I think it also depends on the size of your images. If they are huge megapixel files processing them on the fly might cause severe lag. Still adding a watermark to an image with 100-200 thousand pixels is done within milliseconds on a modern machine. (You probably meant to send this to the list) The OP spoke about a kind of online photo viewer, so I assumed e.g. JPEGs at 1024x768 as a typical size, so about 700K pixels. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Anyone use FileMaker
I'm wondering if anyone here has experience integrating FileMaker with PHP using either ODBC or JDBC. -- Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] [scalability, performance, DoS] To or not to process images at runtime
@Per Jessen Disk-space is cheap, especially if you don't need to be worried about backup etc. I'm not sure why you think applying watermarks in an off-line process would any less manageable than doing it on-line. Well, the processing will be online in the sense that it will be triggered via an admin interface. The pictures will then be batch-processed by a php script using GD and saved to the disk and later served statically, without the overhead of applying the watermark per-request, at runtime. Less manegeable becouse I would have to keep copies of the pictures on the disk. If I ever want to change these watermarks, I would have to somehow recreate them. It is more work to do than if I used the per-request runtime applying of watermark approach, since in this case, I would just apply the watermarks I wanted and then serve the stream directly from memory. Sounds like you are planning to do the processing off-line then. You could even do a mix - if you've got a lot of photos (millions and milloins), applying the watermarks could take a while in itself, so you could leave that running slowly in the background, but combine it with an on-line process that does on-demand watermarking (when the photo is displayed). Yes, applying the watermarks offline in a batch to lots of images could take a while, but the album wouldn't be published before this process is done. So, I don't really understand what you mean by mixing the two approaches. @Nathan for the code that will invoke the watermarking, put it behind another layer, so that you can easily alter it in the future as the site grows. for example, you might use strategy pattern, and your initial strategy will use the current webserver directly. however, as the site begins to grow, you can add additional webservers, dedicated to running gd on top of php. you can then write a strategy which will pass the requests off to those boxe(s), and it will be transparent to your existing code that knows only of the strategy interface. also, as you grow, distributed filesystems are key. for example, your front-end webserver can handle requests from users on the site, dispatch a request (restful for instance) to another box, dedicated to gd. since both boxes share a common filesystem via nfs (or other) the gd box can create the watermark, which will then be immediately available to the front-end box, which it could signal w/ another request to say 'hey, the watermark is ready'. You have come with some great insights, the strategy idea seems nice and could work. Adding dedicated image processing boxes is a good idea, even better if the software to apply it is written in C, but I don't think my use case justifies such an investment of time and money. Another thing that you mentioned that is of great interest to me is the use of a distributed filesystem, since I think I will just pre-process the images in batch to add the watermark, the use of HDD space will grow considerably as time goes by and the app grow. Is this approach transparent enough so that architectural changes to the app wouldn't be necessary? Thank you all for the replies! Marcelo. On Thu, Aug 7, 2008 at 3:52 AM, Per Jessen [EMAIL PROTECTED] wrote: Bernhard Kohl wrote: I think it also depends on the size of your images. If they are huge megapixel files processing them on the fly might cause severe lag. Still adding a watermark to an image with 100-200 thousand pixels is done within milliseconds on a modern machine. (You probably meant to send this to the list) The OP spoke about a kind of online photo viewer, so I assumed e.g. JPEGs at 1024x768 as a typical size, so about 700K pixels. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] [scalability, performance, DoS] To or not to process images at runtime
Marcelo de Moraes Serpa wrote: Less manegeable becouse I would have to keep copies of the pictures on the disk. If I ever want to change these watermarks, I would have to somehow recreate them. It is more work to do than if I used the per-request runtime applying of watermark approach, since in this case, I would just apply the watermarks I wanted and then serve the stream directly from memory. Hmm, I don't usually think more work = less managable, but that's a matter for you. My personal take on this type of thing - I would go for the on-demand watermarking, but with a cached copy of everything that is watermarked. on-demand = when a photo is published the first time. Like Bernhard said earlier, it probably takes a few milliseconds to apply a watermark, so the very first time a photo is viewed, the viewer might just experience the slightest delay. With apache this is really easy to do: RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-s RewriteRule ^(.+)$ apply_watermark.php?name=$1 This means: if photo-with-watermark doesn't exist, run apply-watermark.php to apply a watermark, write the photo-with-watermark to cache/disk, and then output the watermarked photo. If you need to change the watermark, just erase the cached copies and they're regenerated next time someone wants to view a photo. To save on disk-space if that is a concern, you can run regular purges of cached copies that haven't been viewed for a while: find cachedir -atime +30 -type f | xargs rm /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php File upload
Tom wrote: Hi, on a linux system (Suese 10.2) with 1 GB memory its not possible to upload via http a 1 Gb File. Thats no limit problem on my php config. i can look the mem stats when uploading and the growing tmp file. If the temp file has 900 MB, Main Memory free is 0 and the script aborts and php deletes the tmp file. Why don't php use swap memory ? It doesn't need to - as you've noticed, the uploaded file is being written to disk, it's not being kept in memory. This sounds like a php limit problem to me. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php File upload
No, ist'not a php limit. The upload is written in main memory, if i look with vmstat, free is going to 0 and the php upload breaks at 0 bytes free. Nothing swap used. Any other ideas? Per Jessen [EMAIL PROTECTED] schrieb im Newsbeitrag news:[EMAIL PROTECTED] Tom wrote: Hi, on a linux system (Suese 10.2) with 1 GB memory its not possible to upload via http a 1 Gb File. Thats no limit problem on my php config. i can look the mem stats when uploading and the growing tmp file. If the temp file has 900 MB, Main Memory free is 0 and the script aborts and php deletes the tmp file. Why don't php use swap memory ? It doesn't need to - as you've noticed, the uploaded file is being written to disk, it's not being kept in memory. This sounds like a php limit problem to me. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] An appeal to your better nature
On Thursday 07 August 2008 03:57:06 you wrote: On Thu, 2008-08-07 at 00:46 +0200, Børge Holen wrote: On Wednesday 06 August 2008 20:00:50 tedd wrote: At 9:11 AM -0400 8/5/08, Daniel Brown wrote: On Tue, Aug 5, 2008 at 8:53 AM, Aschwin Wesselius [EMAIL PROTECTED] wrote: I wouldn't like to loose my stuff, but I can't afford much for the best solutions either. It's not that my job depends on it, but personal data is a big loss too. Tell me about it. One of the sickest feelings in the world comes when you hear your hard drive start going click click choke click No question about it. That's the reason why I have three backup systems. One in my garage in a fireproof safe that's in another fireproof safe; One hidden in my house in another fireproof safe; And one attached to my main computer that I backup everyday, or more often, which is stored (when not in use) in a yet another waterproof and fireproof safe. (I'm big on fireproof safes) All of which are protected by me and my guns. The only way I'm going to lose any data is if my place is stuck by a meteor. Sure it takes a lot of time to backup, but less than the alternative. I'm just gonna comment some here. Hell, it's a bitch to loose data, but I give you this... These pro's here, ain't getting things done, no time for it between backups. The time they use each year on backup you can write new code tenfold. ;D muhaha What are you yammering on about? A simple cron job can do the backup while I sleep-- Look ma... I work while I sleep! tell me, you really didn't get the point I was making; after all the good advices ppl are making? Cheers, Rob. -- --- Børge Holen http://www.arivene.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: RSS Feed using PHP/MySQL errors
Don Mak wrote: Trying to create an articles rss feed for my site and I keep getting an error that says: = A semi colon character was expected. Line: 7 Character: 60 linkhttp://www.chirunning.com/shop/pages.php?pageid=19id=383/link = This is an easy one: in both of the following lines @mysql_connect('localhost', 'x', 'x') or die('ERROR--CAN'T CONNECT TO SERVER'); @mysql_select_db('shop') or die('ERROR--CAN'T CONNECT TO DB'); you have an unescaped ' in the die() message. Suggest you use one of: die(ERROR--CAN'T CONNECT TO SERVER); die('ERROR--CAN\'T CONNECT TO SERVER'); die('ERROR--CANNOT CONNECT TO SERVER'); // English is a very powerful language!! and similar for the other message... There may be other errors in your code, but that's all you were asking about. -- Peter Ford phone: 01580 89 Developer fax: 01580 893399 Justcroft International Ltd., Staplehurst, Kent -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php File upload
Tom wrote: No, ist'not a php limit. The upload is written in main memory, if i look with vmstat, free is going to 0 and the php upload breaks at 0 bytes free. Nothing swap used. Any other ideas? Interesting problem - maybe an apache limit? Lack of diskspace? Permissions? Which error do you get? /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] ReflectionClass
Hi, Do you know where can I find more information about using the ReflectionClass. What is it for? In which situation can I use it and so on. Thank you in advance! Viktor -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php File upload
No Apache limit, enough diskspace, no permission problem. Fact is: During upload looking at main memory, goes to 0 and if 0 uploadet tmp File was deleted and no error occur. It was great, if anybody can test such a upload. The uploaded File musst be greater as main memory. While teh uload is running, take a look at memory with vmstat. free is goin to 0, no swap is used. I don't know, that is a suse 10.2 effcet only. Per Jessen [EMAIL PROTECTED] schrieb im Newsbeitrag news:[EMAIL PROTECTED] Tom wrote: No, ist'not a php limit. The upload is written in main memory, if i look with vmstat, free is going to 0 and the php upload breaks at 0 bytes free. Nothing swap used. Any other ideas? Interesting problem - maybe an apache limit? Lack of diskspace? Permissions? Which error do you get? /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php File upload
No Apache limit, enough diskspace, no permission problem. Fact is: During upload looking at main memory, goes to 0 and if 0 uploadet tmp File was deleted and no error occur. It was great, if anybody can test such a upload. The uploaded File musst be greater as main memory. While teh uload is running, take a look at memory with vmstat. free is goin to 0, no swap is used. I don't know, that is a suse 10.2 effcet only. What happens with a smaller file? Say 500Mb? You could gradually increase the file size until you get the error. -- Richard Heyes http://www.phpguru.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php.ini and pgsql extension issue
Got same problem exactly today w/ 5.2.6 with zip archive. Note that there has been many changes w/ pgsql extension in 5.2.6. It seems that extension file is corrupted, or that my piece of software (izarc) don't deal correctly with it. Looks also like daily snapshots of 5.2.6 are corrupted too. 5.3 php_pgsql.dll is abaut 102k. Etienne Massip Alain Roger wrote: Hi, i found and solved an interesting issue under PHP 5.2.6. when i use the standard installation file under windows XP (php-5.2.6-win32-installer.msi), i get several error message in apache error.log file, something like : PHP Warning: PHP Startup: Unable to load dynamic library 'D:\\webserver\\PHP\\ext\\php_mssql.dll' - The specified module could not be found.\r\n in Unknown on line 0 and this for several extensions even if the files are correctly installed in the right folder. I took a previous version of PHP 5.2.3 extension (dll) and i compare the size: in PHP 5.2.6, php_pgsql.dll is 96 kb whereas it is 164 kb under PHP 5.2.3. so i just replace the 96 kb file by the 164 kb and restart apache 2.2.8. now it works perfectly. i reproduced the same thing for all dynamic extensions which were generating the same issue and all works. it could be interesting that developers of PHP take an eye on it. -- Alain Windows XP SP2 PostgreSQL 8.2.4 / MS SQL server 2005 Apache 2.2.4 PHP 5.2.4 C# 2005-2008 -- View this message in context: http://www.nabble.com/php.ini-and-pgsql-extension-issue-tp18799813p18869371.html Sent from the PHP - General mailing list archive at Nabble.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How to encrypt php code.
Hi folks, I have Given a task to make a application installation using key. The installation file is ready I have to just add the Registration key feature. I have to do following task. 1. when user gives the url a installation page apears. when he clicks on user agree terms, it goes to then next page where he give information about database and other stuff with the registration key. 2. If the registration key goes to the company's site and checks for authetication and if they have bought the product or not. can any one tell me how do i go about this? and also how do will make these code unreadable so that user could not manuplate the code. get access without registration. Please Do reply. thank you.
Re: [PHP] How to encrypt php code.
On Aug 7, 2008, at 8:57 AM, mukesh yadav wrote: Hi folks, I have Given a task to make a application installation using key. The installation file is ready I have to just add the Registration key feature. I have to do following task. 1. when user gives the url a installation page apears. when he clicks on user agree terms, it goes to then next page where he give information about database and other stuff with the registration key. 2. If the registration key goes to the company's site and checks for authetication and if they have bought the product or not. can any one tell me how do i go about this? and also how do will make these code unreadable so that user could not manuplate the code. get access without registration. I don't know HOW to do it, but I think I know the concept and maybe that would be enough to get you started? Basically, you need to throw in some salt. Some random, but unique piece of info that is not stored as part of the original key to help authenticate it... Now that I'm typing this out I'm not sure I do understand the concept completely hehehe :) Look at adding salt, maybe something from the database, or something else that you can control. -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 11287 James St Holland, MI 49424 www.raoset.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Object overhead vs. arrays
I knew that there would be some overhead when working with objects vs working with arrays, but I didn't expect this much. Is there some optimization that I could do to improve the performance any? While the script below is just a benchmark test script, it approximates functionality that I'm going to need to implement. Ultimately, I need to iterate through a large amount of data and am wondering if perhaps I should encapsulate the data in objects (which closer represents the underlying data) or if I should encapsulate it in arrays. Based on what I'm seeing in this benchmark script, it seems like it should be the latter... Advice and/or input would be much appreciated! thnx, Christoph ?php class TestObj { private $sVar1; private $sVar2; private $sVar3; private $aVar4; public function __construct() { } public function setVar1( $sValue ) { $this-sVar1 = $sValue; } public function setVar2( $sValue ) { $this-sVar2 = $sValue; } public function setVar3( $sValue ) { $this-sVar3 = $sValue; } public function setVar4( $aValue ) { $this-aVar4 = $aValue; } } $iMaxIterations = rand( 1, 123456 ); $iMaxElements = rand( 1, 10 ); $aMasterArraysArray = array(); $aMasterObjsArray = array(); $aWorkingTmp = array(); for( $i = 0; $i = $iMaxElements; $i++ ) { $aWorkingTmp[] = 'Testing'; } $iStartTime = microtime( TRUE ); for( $i = 0; $i $iMaxIterations; $i++ ) { $aTmp = array(); $aTmp['var1'] = rand(); $aTmp['var2'] = rand(); $aTmp['var3'] = rand(); $aTmp['var4'] = $aWorkingTmp; $aMasterArraysArray[] = $aTmp; } $iEndTime = microtime( TRUE ); $iArrayTotalTime = ( $iEndTime - $iStartTime ); echo $iArrayTotalTime . ' seconds elapsed for [' . $iMaxIterations . '] iterations for ARRAY.br'; $iStartTime = microtime( TRUE ); for( $i = 0; $i $iMaxIterations; $i++ ) { $oTmp = new TestObj(); $oTmp-setVar1( rand()); $oTmp-setVar2( rand()); $oTmp-setVar3( rand()); $oTmp-setVar4( $aWorkingTmp ); $aMasterObjsArray[] = $oTmp; } $iEndTime = microtime( TRUE ); $iObjectTotalTime = ( $iEndTime - $iStartTime ); echo $iObjectTotalTime . ' seconds elapsed for [' . $iMaxIterations . '] iterations for OBJECTS.brbr'; if( $iArrayTotalTime $iObjectTotalTime ) { echo 'Arrays took [' . ( $iArrayTotalTime - $iObjectTotalTime ) . '] seconds longer, a factor of [' . ( $iArrayTotalTime / $iObjectTotalTime ) . ']br'; } else { echo 'Objects took [' . ( $iObjectTotalTime - $iArrayTotalTime ) . '] seconds longer, a factor of [' . ( $iObjectTotalTime / $iArrayTotalTime ) . ']br'; } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php File upload
smaller files is no problem. The error occoured, if the uploaded File is bigger than the installed main memory. Ok, i know that http ist not designed for big uploads. But on a big website with upload enabled and 30 users upload simultan a 20 MB File, they lost the upload while php hold all in memory/Cache and swap is not used. I don't understand why php write the upload chunck for chunck (i can look this) in upload temp file AND holds the upload in main memory. Richard Heyes [EMAIL PROTECTED] schrieb im Newsbeitrag news:[EMAIL PROTECTED] No Apache limit, enough diskspace, no permission problem. Fact is: During upload looking at main memory, goes to 0 and if 0 uploadet tmp File was deleted and no error occur. It was great, if anybody can test such a upload. The uploaded File musst be greater as main memory. While teh uload is running, take a look at memory with vmstat. free is goin to 0, no swap is used. I don't know, that is a suse 10.2 effcet only. What happens with a smaller file? Say 500Mb? You could gradually increase the file size until you get the error. -- Richard Heyes http://www.phpguru.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php File upload
Well, you lost me right about... Well when you started. But memory is cheap...:-/ -- Richard Heyes http://www.phpguru.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php File upload
hmm, memory buying is okay, not the final solution. I think php design fault on this function. It's not comprehensible why php use such a lot main memory for an upload. Richard Heyes [EMAIL PROTECTED] schrieb im Newsbeitrag news:[EMAIL PROTECTED] Well, you lost me right about... Well when you started. But memory is cheap...:-/ -- Richard Heyes http://www.phpguru.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Scripts for removing Reg entries
I was looking thru some of the scripts that were mentioned and I am wondering if there is a way to write on that will delete registry entries? I am trying to uninstall Office 97 on XP machines and there are a lot of pieces left after the uninstall has run. I would need to look and see if the entry exists and if it does delete it. Also, is there a way to script removing items that have been pinned to the start menu? Ryan Perkins Dept. of Employee Trust Funds Operations/ Help Desk 608.266.2080 This email message and any attachments may contain information that is confidential, privileged, proprietary, or otherwise protected by law. This information is intended solely for the named addressee (or a person responsible for delivering it to the addressee). If you have received this message in error, please notify the sender immediately and delete it from your computer. Unauthorized disclosure, copying, printing, or distribution of this message is prohibited. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Version Control Software
Robert Cummings wrote: On Thu, 2008-08-07 at 09:43 +1000, Ross McKay wrote: On Wed, 6 Aug 2008 16:42:23 -0400, Benjamin Darwin wrote: [...] I'm wondering if anybody knows of a version control software program that may fit my needs. Basically, I'm looking for something that runs locally, not on the live site, that I can edit the files on the dev computer, and store old versions on the dev computer, and then just publish off of the local onto the live site whenever I need to. [...] A couple of very easy-to-use ones are Subversion and CVS. Both are very easy to use from a shell / command line, and both have nice GUIs available for both Windows and *nix. Many editors and IDEs will work with CVS directly, and some with Subversion. While I currently use CVS, I probably wouldn't choose it going forward since Subversion solves many of the problems it has... as does GIT if I recall. I'm still using CVS because it works for me and I haven't allocated the time yet to switch over. Yeah I agree here. I wouldn't use CVS on any new project. For me the choices are simple: Git or SVN. Which one would depend on the kind of project (binary data?) and the team size/independent working requirements. Col -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Why PHP4?
Kudos to Richard. If its fixed, don't break it. Jud. == Per Jessen wrote: Richard Heyes wrote: I'm interested - why are people still using PHP4? It's been over 4 years (I think) - plenty of time to upgrade to five. Migration issues for instance - we have quite a bit of code that uses sablotron - in PHP5 that's been changed to libxslt, which requires extensive code-changes. Also, something about setlocale() got regressed (and never fixed) in 4.3.10 or thereabouts, which means we have at least one app that's running on 4.3.8. Finally - why migrate? What's the rush? Lots of people are still running back-level software - e.g. apache, mysql, php, gcc, linux, you name it. *In our shop, migrating working PHP code has one of the lowest priorities*. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php File upload
Tom wrote: But on a big website with upload enabled and 30 users upload simultan a 20 MB File, they lost the upload while php hold all in memory/Cache and swap is not used. I don't understand why php write the upload chunck for chunck (i can look this) in upload temp file AND holds the upload in main memory. Well, I can't reproduce the problem - I uploaded a 1Gb file, and I never saw apache memory usage go beyond 15Mb. Might this problem be in your code processing the uploaded file(s)? In this test I just uploaded the file, I never tried to process it. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] An appeal to your better nature
At 11:50 AM +0200 8/7/08, Børge Holen wrote: On Thursday 07 August 2008 03:57:06 you wrote: On Thu, 2008-08-07 at 00:46 +0200, Børge Holen wrote: On Wednesday 06 August 2008 20:00:50 tedd wrote: Sure it takes a lot of time to backup, but less than the alternative. I'm just gonna comment some here. Hell, it's a bitch to loose data, but I give you this... These pro's here, ain't getting things done, no time for it between backups. The time they use each year on backup you can write new code tenfold. ;D muhaha What are you yammering on about? A simple cron job can do the backup while I sleep-- Look ma... I work while I sleep! tell me, you really didn't get the point I was making; after all the good advices ppl are making? Sorry, I didn't get your point either. My backups are done whenever I want to take a break -- two clicks and everything is backed up by time I get back. Simple. The remote backups take longer because I have to physically go get the drives out of my safes, and that happens about one a week -- besides, I need the exercise. The online stuff, I can never trust so I don't rely on it. After all, service centers do catch fire. Backups are like home defense, don't rely on the cops, don't rely on the neighbors, don't rely on remote services, only you can safeguard your stuff. The question of how much to backup is like gambling, risk only what you can afford to lose. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php File upload
Tom wrote: hmm, memory buying is okay, not the final solution. I think php design fault on this function. It's not comprehensible why php use such a lot main memory for an upload. Well, PHP doesn't - the upload is apaches job. Once the file is uploaded, PHP is invoked to process it. You do your move_uploaded_file() etc. What do you do to the uploaded file? /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Variable number of parameters
Oops! Meant to send this to the list On Aug 7, 2008, at 9:31 AM, Philip Thompson wrote: On Aug 6, 2008, at 4:25 PM, Shawn McKenzie wrote: Philip Thompson wrote: Is it possible to grab a variable number of parameters and send the appropriate amount to another function? ?php // Some class $this-db-prepare(SELECT * FROM `table` WHERE (`id`=?)); $this-db-bind('ii', $id1); $this-db-prepare(SELECT * FROM `table` WHERE (`id`=? AND `other_id`=?)); $this-db-bind('ii', $id1, $id2); // DB class function bind () { $args = func_get_args(); $this-statement-bind_param($args[0], $args[1], ...); } ? Ok, is it possible to send any number of variables to db-bind() in order to send those to statement-bind_param()? Or, if someone else has a better db abstraction method, feel free to educate... Thanks, ~Phil I'm confused as your code looks like it's already doing what you're asking. It's hard to tell without seeing what bind_param() looks like. But just a thought to use arrays in one of two ways: // 1. $this-db-bind('ii', $id1, $id2); function bind () { $args = func_get_args(); $this-statement-bind_param($args); // then bind_param() can count the number of args and use them } //2. $this-db-bind('ii', array($id1, $id2)); function bind ($var, $ids) { // pass thru to bind_param() $this-statement-bind_param($var, $ids); // then bind_param() can use the $ids array // or count the ids and send individual args to bind_param() } As I said, it's kind of hard to tell without knowing exactly what you want to achieve. One of the more elegant ways that I have seen is to pass required args and then an array of args that the receiving function can use, like: $this-db-bind('ii', array('someoption'=$id1, 'feature'=$id2, 'action'='doit')); Need more info on the desired outcome. -Shawn The bind_param() function is a built-in PHP MySQLi function (http://php.net/mysqli_bind_param ). I can't change how this accepts args (of course). Thanks for your thoughts anyway. =D ~Philip innerHTML is a string. The DOM is not a string, it's a hierarchal object structure. Shoving a string into an object is impure and similar to wrapping a spaghetti noodle around an orange and calling it lunch. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] An appeal to your better nature
On Thursday 07 August 2008 16:28:12 tedd wrote: At 11:50 AM +0200 8/7/08, Børge Holen wrote: On Thursday 07 August 2008 03:57:06 you wrote: On Thu, 2008-08-07 at 00:46 +0200, Børge Holen wrote: On Wednesday 06 August 2008 20:00:50 tedd wrote: Sure it takes a lot of time to backup, but less than the alternative. I'm just gonna comment some here. Hell, it's a bitch to loose data, but I give you this... These pro's here, ain't getting things done, no time for it between backups. The time they use each year on backup you can write new code tenfold. ;D muhaha What are you yammering on about? A simple cron job can do the backup while I sleep-- Look ma... I work while I sleep! tell me, you really didn't get the point I was making; after all the good advices ppl are making? Sorry, I didn't get your point either. My backups are done whenever I want to take a break -- two clicks and everything is backed up by time I get back. Simple. The remote backups take longer because I have to physically go get the drives out of my safes, and that happens about one a week -- besides, I need the exercise. The online stuff, I can never trust so I don't rely on it. After all, service centers do catch fire. Backups are like home defense, don't rely on the cops, don't rely on the neighbors, don't rely on remote services, only you can safeguard your stuff. The question of how much to backup is like gambling, risk only what you can afford to lose. You actually didn't read what I replied to, what are you commenting then? Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- --- Børge Holen http://www.arivene.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] An appeal to your better nature
At 4:35 PM +0200 8/7/08, Børge Holen wrote: On Thursday 07 August 2008 16:28:12 tedd wrote: At 11:50 AM +0200 8/7/08, Børge Holen wrote: I'm just gonna comment some here. Hell, it's a bitch to loose data, but I give you this... These pro's here, ain't getting things done, no time for it between backups. The time they use each year on backup you can write new code tenfold. ;D muhaha What are you yammering on about? A simple cron job can do the backup while I sleep-- Look ma... I work while I sleep! tell me, you really didn't get the point I was making; after all the good advices ppl are making? Sorry, I didn't get your point either. You actually didn't read what I replied to, what are you commenting then? Huh? I still don't get your point. My additional comments beyond not getting your point were obviously about backups -- was that not clear? It is acceptable and common to carry more than one point/topic in a communication. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php File upload
With what linux BS have you tested? No, it isn't the apaches job/problem. I do nothing with the file. Looking for $_FILES Varables and then move_uploaded_file. But i said it before, the problem is not at this point. If i upload the file and watch memory with vmstat, free is going 0, cache is going to top and if free is 0 = temp file was deleted and script witout an error comes back. At the crash point, the File is not complete uploaded, so my $_FILES have no entry about the file specs. Im hanging some days with many tests on differnet machines (alls suse) on this Problem and can't solve it :-( Per Jessen [EMAIL PROTECTED] schrieb im Newsbeitrag news:[EMAIL PROTECTED] Tom wrote: hmm, memory buying is okay, not the final solution. I think php design fault on this function. It's not comprehensible why php use such a lot main memory for an upload. Well, PHP doesn't - the upload is apaches job. Once the file is uploaded, PHP is invoked to process it. You do your move_uploaded_file() etc. What do you do to the uploaded file? /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php File upload
Tom wrote: With what linux BS have you tested? It was an older SUSE Linux 8.2. But the OS shouldn't matter - maybe the PHP release and maybe the apache ditto. No, it isn't the apaches job/problem. I do nothing with the file. Looking for $_FILES Varables and then move_uploaded_file. That's exactly what I just did. But i said it before, the problem is not at this point. If i upload the file and watch memory with vmstat, free is going 0, cache is going to top and if free is 0 = temp file was deleted and script witout an error comes back. At the crash point, the File is not complete uploaded, so my $_FILES have no entry about the file specs. Ah, so it's not PHP and it's not apache using up your memory - it's your filesystem cache. Check how many files you have in the tmp directory and the destination directory. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] An appeal to your better nature
On Thursday 07 August 2008 16:58:32 tedd wrote: At 4:35 PM +0200 8/7/08, Børge Holen wrote: On Thursday 07 August 2008 16:28:12 tedd wrote: At 11:50 AM +0200 8/7/08, Børge Holen wrote: I'm just gonna comment some here. Hell, it's a bitch to loose data, but I give you this... These pro's here, ain't getting things done, no time for it between backups. The time they use each year on backup you can write new code tenfold. ;D muhaha What are you yammering on about? A simple cron job can do the backup while I sleep-- Look ma... I work while I sleep! tell me, you really didn't get the point I was making; after all the good advices ppl are making? Sorry, I didn't get your point either. You actually didn't read what I replied to, what are you commenting then? Huh? I still don't get your point. My additional comments beyond not getting your point were obviously about backups -- was that not clear? It is acceptable and common to carry more than one point/topic in a communication. nah, we do not communicate very good. stops here, we're clearly not on the same topic Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- --- Børge Holen http://www.arivene.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php File upload
Ah, so it's not PHP and it's not apache using up your memory - it's your filesystem cache. Check how many files you have in the tmp directory and the destination directory. Okay, thats light in the darkness. But i don't have any idea what i can do here. tmp is empty. Look at the first entry, its after the upload start. The last entry is after free = 0 and break. I really have no idea whats going on here. procs ---memory-- ---swap-- -io -system-- cpu r b swpd free buff cache si sobibo in cs us sy id wa 0 0 0 677076 28020 216052001758 370 166 1 0 98 1 linuxserver:/tmp # vmstat procs ---memory-- ---swap-- -io -system-- cpu r b swpd free buff cache si sobibo in cs us sy id wa 1 0 0 667404 28028 225536001758 371 167 1 0 98 1 linuxserver:/tmp # vmstat procs ---memory-- ---swap-- -io -system-- cpu r b swpd free buff cache si sobibo in cs us sy id wa 0 1 0 660088 28036 231456001760 371 168 1 0 98 1 linuxserver:/tmp # vmstat procs ---memory-- ---swap-- -io -system-- cpu r b swpd free buff cache si sobibo in cs us sy id wa 0 1 0 656616 28040 235820001760 372 168 1 0 98 1 linuxserver:/tmp # vmstat procs ---memory-- ---swap-- -io -system-- cpu r b swpd free buff cache si sobibo in cs us sy id wa 0 0 0 653640 28052 239364001760 372 168 1 0 98 1 linuxserver:/tmp # vmstat procs ---memory-- ---swap-- -io -system-- cpu r b swpd free buff cache si sobibo in cs us sy id wa 0 0 0 650044 28056 242948001760 372 168 1 0 98 1 linuxserver:/tmp # vmstat procs ---memory-- ---swap-- -io -system-- cpu r b swpd free buff cache si sobibo in cs us sy id wa 1 0 0 642480 28060 250432001760 372 169 1 0 98 1 linuxserver:/tmp # vmstat procs ---memory-- ---swap-- -io -system-- cpu r b swpd free buff cache si sobibo in cs us sy id wa 0 0 0 635536 28068 257244001760 373 170 1 0 98 1 linuxserver:/tmp # vmstat procs ---memory-- ---swap-- -io -system-- cpu r b swpd free buff cache si sobibo in cs us sy id wa 1 0 0 630080 28072 262440001760 373 170 1 0 98 1 linuxserver:/tmp # vmstat procs ---memory-- ---swap-- -io -system-- cpu r b swpd free buff cache si sobibo in cs us sy id wa 0 0 0 624500 28080 267892001760 374 170 1 0 98 1 linuxserver:/tmp # vmstat procs ---memory-- ---swap-- -io -system-- cpu r b swpd free buff cache si sobibo in cs us sy id wa 0 2 0 620532 28080 270440001762 374 171 1 0 98 1 linuxserver:/tmp # vmstat procs ---memory-- ---swap-- -io -system-- cpu r b swpd free buff cache si sobibo in cs us sy id wa 0 2 0 620904 28080 270440001762 374 171 1 0 98 1 linuxserver:/tmp # vmstat procs ---memory-- ---swap-- -io -system-- cpu r b swpd free buff cache si sobibo in cs us sy id wa 2 0 0 618672 28092 273756001762 374 171 1 0 98 1 linuxserver:/tmp # vmstat procs ---memory-- ---swap-- -io -system-- cpu r b swpd free buff cache si sobibo in cs us sy id wa 0 0 0 613960 28096 278432001762 374 171 1 0 98 1 linuxserver:/tmp # vmstat procs ---memory-- ---swap-- -io -system-- cpu r b swpd free buff cache si sobibo in cs us sy id wa 0 2 0 114984 28668 768276001788 406 209 1 0 98 1 linuxserver:/tmp # vmstat procs ---memory-- ---swap-- -io -system-- cpu r b swpd free buff cache si sobibo in cs us sy id wa 0 0 0 105932 28684 778608001788 407 210 1 0 98 1 linuxserver:/tmp # vmstat procs ---memory-- ---swap-- -io -system-- cpu r b swpd free buff cache si sobibo in cs us sy id wa 0 0 0 96756 28692 787448001788 407 211 1 0 98 1 linuxserver:/tmp # vmstat procs ---memory-- ---swap-- -io -system-- cpu r b swpd free buff cache si sobibo in cs us
Re: [PHP] php File upload
Tom wrote: Ah, so it's not PHP and it's not apache using up your memory - it's your filesystem cache. Check how many files you have in the tmp directory and the destination directory. Okay, thats light in the darkness. But i don't have any idea what i can do here. tmp is empty. What about the destination directory? Which filesystem are you using? I'll try the 1Gb upload again and see how vmstat reacts. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] An appeal to your better nature
On Thu, 2008-08-07 at 11:50 +0200, Børge Holen wrote: On Thursday 07 August 2008 03:57:06 you wrote: On Thu, 2008-08-07 at 00:46 +0200, Børge Holen wrote: On Wednesday 06 August 2008 20:00:50 tedd wrote: At 9:11 AM -0400 8/5/08, Daniel Brown wrote: On Tue, Aug 5, 2008 at 8:53 AM, Aschwin Wesselius [EMAIL PROTECTED] wrote: I wouldn't like to loose my stuff, but I can't afford much for the best solutions either. It's not that my job depends on it, but personal data is a big loss too. Tell me about it. One of the sickest feelings in the world comes when you hear your hard drive start going click click choke click No question about it. That's the reason why I have three backup systems. One in my garage in a fireproof safe that's in another fireproof safe; One hidden in my house in another fireproof safe; And one attached to my main computer that I backup everyday, or more often, which is stored (when not in use) in a yet another waterproof and fireproof safe. (I'm big on fireproof safes) All of which are protected by me and my guns. The only way I'm going to lose any data is if my place is stuck by a meteor. Sure it takes a lot of time to backup, but less than the alternative. I'm just gonna comment some here. Hell, it's a bitch to loose data, but I give you this... These pro's here, ain't getting things done, no time for it between backups. The time they use each year on backup you can write new code tenfold. ;D muhaha What are you yammering on about? A simple cron job can do the backup while I sleep-- Look ma... I work while I sleep! tell me, you really didn't get the point I was making; after all the good advices ppl are making? *wsh* That was it going over my head :) Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php File upload
i use ext3 Im realy on no limit. destination ist /tmp and is fairly empty. The question is now, if cache full = must hypothetical swap used? ok, im glad to see your result. Per Jessen [EMAIL PROTECTED] schrieb im Newsbeitrag news:[EMAIL PROTECTED] Tom wrote: Ah, so it's not PHP and it's not apache using up your memory - it's your filesystem cache. Check how many files you have in the tmp directory and the destination directory. Okay, thats light in the darkness. But i don't have any idea what i can do here. tmp is empty. What about the destination directory? Which filesystem are you using? I'll try the 1Gb upload again and see how vmstat reacts. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php File upload
Tom wrote: i use ext3 Im realy on no limit. destination ist /tmp and is fairly empty. The question is now, if cache full = must hypothetical swap used? ok, im glad to see your result. No, high utilization of file system cache will not cause any swapping - file system caching uses whatever is spare. If there's nothing, no caching. AFAIU. I can confirm what you're seeing about the cache being used up - I saw that too. My cache-number only went to about 485000, and free only down to 6000-7000. My webserver also has 1Gb RAM, but it does a few more things. Does your free memory actually go as low as 0? I don't think this is about the file system cache - I know you said no limits, but what do you have for post_max_size and upload_max_size ? I'm using 1200M for both for this test. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Variable number of parameters
Philip Thompson wrote: Oops! Meant to send this to the list On Aug 7, 2008, at 9:31 AM, Philip Thompson wrote: On Aug 6, 2008, at 4:25 PM, Shawn McKenzie wrote: Philip Thompson wrote: Is it possible to grab a variable number of parameters and send the appropriate amount to another function? ?php // Some class $this-db-prepare(SELECT * FROM `table` WHERE (`id`=?)); $this-db-bind('ii', $id1); $this-db-prepare(SELECT * FROM `table` WHERE (`id`=? AND `other_id`=?)); $this-db-bind('ii', $id1, $id2); // DB class function bind () { $args = func_get_args(); $this-statement-bind_param($args[0], $args[1], ...); } ? Ok, is it possible to send any number of variables to db-bind() in order to send those to statement-bind_param()? Or, if someone else has a better db abstraction method, feel free to educate... Thanks, ~Phil I'm confused as your code looks like it's already doing what you're asking. It's hard to tell without seeing what bind_param() looks like. But just a thought to use arrays in one of two ways: // 1. $this-db-bind('ii', $id1, $id2); function bind () { $args = func_get_args(); $this-statement-bind_param($args); // then bind_param() can count the number of args and use them } //2. $this-db-bind('ii', array($id1, $id2)); function bind ($var, $ids) { // pass thru to bind_param() $this-statement-bind_param($var, $ids); // then bind_param() can use the $ids array // or count the ids and send individual args to bind_param() } As I said, it's kind of hard to tell without knowing exactly what you want to achieve. One of the more elegant ways that I have seen is to pass required args and then an array of args that the receiving function can use, like: $this-db-bind('ii', array('someoption'=$id1, 'feature'=$id2, 'action'='doit')); Need more info on the desired outcome. -Shawn The bind_param() function is a built-in PHP MySQLi function (http://php.net/mysqli_bind_param). I can't change how this accepts args (of course). Thanks for your thoughts anyway. =D ~Philip innerHTML is a string. The DOM is not a string, it's a hierarchal object structure. Shoving a string into an object is impure and similar to wrapping a spaghetti noodle around an orange and calling it lunch. function bind () { $args = func_get_args(); call_user_func_array(array($this-statement, 'bind_param'), $args); } Maybe? -Shawn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: ReflectionClass
Viktor Popov wrote: Hi, Do you know where can I find more information about using the ReflectionClass. What is it for? In which situation can I use it and so on. Thank you in advance! Viktor http://php.net/language.oop5.reflection -Shawn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Scripts for removing Reg entries
Perkins, Ryan wrote: I was looking thru some of the scripts that were mentioned and I am wondering if there is a way to write on that will delete registry entries? I am trying to uninstall Office 97 on XP machines and there are a lot of pieces left after the uninstall has run. I would need to look and see if the entry exists and if it does delete it. Also, is there a way to script removing items that have been pinned to the start menu? Ryan Perkins Dept. of Employee Trust Funds Operations/ Help Desk 608.266.2080 This email message and any attachments may contain information that is confidential, privileged, proprietary, or otherwise protected by law. This information is intended solely for the named addressee (or a person responsible for delivering it to the addressee). If you have received this message in error, please notify the sender immediately and delete it from your computer. Unauthorized disclosure, copying, printing, or distribution of this message is prohibited. I'm sure you would be much better off with vbscript in this case. -Shawn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Version Control Software
On Thu, Aug 7, 2008 at 10:02 AM, Colin Guthrie [EMAIL PROTECTED] wrote: Robert Cummings wrote: On Thu, 2008-08-07 at 09:43 +1000, Ross McKay wrote: On Wed, 6 Aug 2008 16:42:23 -0400, Benjamin Darwin wrote: [...] I'm wondering if anybody knows of a version control software program that may fit my needs. Basically, I'm looking for something that runs locally, not on the live site, that I can edit the files on the dev computer, and store old versions on the dev computer, and then just publish off of the local onto the live site whenever I need to. [...] A couple of very easy-to-use ones are Subversion and CVS. Both are very easy to use from a shell / command line, and both have nice GUIs available for both Windows and *nix. Many editors and IDEs will work with CVS directly, and some with Subversion. While I currently use CVS, I probably wouldn't choose it going forward since Subversion solves many of the problems it has... as does GIT if I recall. I'm still using CVS because it works for me and I haven't allocated the time yet to switch over. Yeah I agree here. I wouldn't use CVS on any new project. For me the choices are simple: Git or SVN. Which one would depend on the kind of project (binary data?) and the team size/independent working requirements. Col Thanks everyone for the opinions. I'm looking into Subversion and GIT, and hopfully installating one (or both) to test later today. --Ben
[PHP] A few questions about PHP's SOAP module
* I'm trying to better understand the 'classmap' option for the SoapClient class. Is it used to define the class of an instantiated object which will be passed as an argument to the server's function call? So, as a very simplistic example, it might go something like this: ?php class MyClass { public $sStockSymbol ; public function __construct( $sStockSymbol ) { $this-sStockSymbol = $sStockSymbol; } } $oObj = new MyClass( 'ibm' ); $oClient = new SoapClient( $sWSDL_URI, array( 'classmap' = array( 'StockSymbol' = 'MyClass' ))); $oClient-getStockValue( $oObj ); ? Am I even close? Now, what happens if one of the required arguments to the server function is a variable that has a hyphen in it? Is there any way I can get around that since PHP doesn't allow you to define variables with hyphens? * Whether using class/objects to pass parameters to a server function (assuming I have the above correct) or arrays, how can you define further attributes for each parameter? Is that even possible? So here is an example of a SOAP message that the server is expecting: ?xml version=1.0? soap:Envelope xmlns:soap=http://schemas.xmlsoap.org/soap/envelope/; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xmlns:xsd=http://www.w3.org/2001/XMLSchema; soap:Body ServerFuncName xmlns=urn:/joe/bob/briggs/types String1Var1 Value/String1 String2live/String2 Array1 SubArray1 status=complete SubArray2 xmlns= encoding= node-type= SubArray3 node name=attribute1Node Value/node node name=attribute2Node Value/node node name=attribute3Node Value/node node name=attribute4Node Value/node node name=attribute5Node Value/node /SubArray3 /SubArray2 SubArray2 xmlns= encoding= node-type=/SubArray2 /SubArray1 /Array1 /ServerFuncName /soap:Body /soap:Envelope How can I set up the attributes illustrated above? Encoding, node-type, etc? Is that possible? * Finally, is there a really good and/or comprehensive tutorial and/or write-up on PHPs SOAP module? The documentation is pretty spartan and what I have found doesn't really go in to much depth. Any help would be greatly appreciated! thnx, Christoph -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Version Control Software
-Original Message- From: Benjamin Darwin [mailto:[EMAIL PROTECTED] Sent: Thursday, August 07, 2008 2:05 PM To: Colin Guthrie Cc: php-general@lists.php.net Subject: Re: [PHP] Re: Version Control Software I'm wondering if anybody knows of a version control software program that may fit my needs. Basically, I'm looking for something that runs locally, not on the live site, that I can edit the files on the dev computer, and store old versions on the dev computer, and then just publish off of the local onto the live site whenever I need to. [...] A couple of very easy-to-use ones are Subversion and CVS. Both are very easy to use from a shell / command line, and both have nice GUIs available for both Windows and *nix. Many editors and IDEs will work with CVS directly, and some with Subversion. While I currently use CVS, I probably wouldn't choose it going forward since Subversion solves many of the problems it has... as does GIT if I recall. I'm still using CVS because it works for me and I haven't allocated the time yet to switch over. Yeah I agree here. I wouldn't use CVS on any new project. For me the choices are simple: Git or SVN. Which one would depend on the kind of project (binary data?) and the team size/independent working requirements. Col Thanks everyone for the opinions. I'm looking into Subversion and GIT, and hopfully installating one (or both) to test later today. Having never used a revision-control solution in the past, I installed TortoiseSVN and the associated SVN Server (local-only) found on www.tigris.org . I've gotta say... it's been a breeze to setup (I used the SVN 1-Click Setup installer), and I've already migrated several of the projects I'm working on to the repository and tested extractions and versioning. Pretty slick! I can't speak for GIT... but if it's mostly command line, with 130+ switches, I think I'll pass. Todd Boyd Web Programmer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php File upload
Hi Per, your result is on a suse 8.2 ? hmm, i don't know the reason why my suse 10.2 machines do that failure. My limits for for post_max_size and upload_max_size is both 1500M. Greets thanx, Tom Per Jessen [EMAIL PROTECTED] schrieb im Newsbeitrag news:[EMAIL PROTECTED] Tom wrote: i use ext3 Im realy on no limit. destination ist /tmp and is fairly empty. The question is now, if cache full = must hypothetical swap used? ok, im glad to see your result. No, high utilization of file system cache will not cause any swapping - file system caching uses whatever is spare. If there's nothing, no caching. AFAIU. I can confirm what you're seeing about the cache being used up - I saw that too. My cache-number only went to about 485000, and free only down to 6000-7000. My webserver also has 1Gb RAM, but it does a few more things. Does your free memory actually go as low as 0? I don't think this is about the file system cache - I know you said no limits, but what do you have for post_max_size and upload_max_size ? I'm using 1200M for both for this test. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php File upload
Tom wrote: Hi, on a linux system (Suese 10.2) with 1 GB memory its not possible to upload via http a 1 Gb File. Thats no limit problem on my php config. i can look the mem stats when uploading and the growing tmp file. If the temp file has 900 MB, Main Memory free is 0 and the script aborts and php deletes the tmp file. Why don't php use swap memory ? Greets Tom After reading this thread, I would like to add my thoughts. What Apache starts, it reads the PHP memory limits in to the running Apache process. When you try and upload a file, it is a straight HTTP upload. PHP plays no part in the actual upload, except for the upload limits set in place by the php settings found in the php.ini or other Apache config files. Now, Apache actually handles the Upload. Once the file has been received completely, Apache then passes the file and process running to PHP. I have never seen a case where Apache has stored the file on the file system. In my past experience it has always held the file in memory, therefor limited to the max physical memory that was install, minus a little for other things. I have worked on Debian (potato|woody|sarge), Redhat 5.0 - 9, Fedora 1 - 7, OpenBSD 3.6-current, and older versions of NetBSD and FreeBSD. I have also frequented a number of friends installs and I have never seen uploads happen any other way. Nor have I heard of uploads happening any other way. Just my 2cents :) -- Jim Lucas Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them. Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP 4.4.9 Released!
Hello, The PHP development team would like to announce the immediate availability of PHP 4.4.9. It continues to improve the security and the stability of the 4.4 branch and all users are strongly encouraged to upgrade to it as soon as possible. This release wraps up all the outstanding patches for the PHP 4.4 series, and is therefore the last PHP 4.4 release. Security Enhancements and Fixes in PHP 4.4.9: * Updated PCRE to version 7.7. * Fixed overflow in memnstr(). * Fixed crash in imageloadfont when an invalid font is given. * Fixed open_basedir handling issue in the curl extension. * Fixed mbstring.func_overload set in .htaccess becomes global. A separate release announcement is also available. For changes in PHP 4.4.9 since PHP 4.4.8, please consult the PHP 4 ChangeLog. Release Announcement: http://www.php.net/release_4_4_9.php Downloads:http://www.php.net/downloads.php#v4 Changelog:http://www.php.net/ChangeLog-4.php#4.4.9 regards, Derick -- http://derickrethans.nl | http://ezcomponents.org | http://xdebug.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php File upload
Tom's machine only has 1 GB of physical memory doesn't it? Could that be the problem? 2008/8/7 Jim Lucas [EMAIL PROTECTED] Tom wrote: Hi, on a linux system (Suese 10.2) with 1 GB memory its not possible to upload via http a 1 Gb File. Thats no limit problem on my php config. i can look the mem stats when uploading and the growing tmp file. If the temp file has 900 MB, Main Memory free is 0 and the script aborts and php deletes the tmp file. Why don't php use swap memory ? Greets Tom After reading this thread, I would like to add my thoughts. What Apache starts, it reads the PHP memory limits in to the running Apache process. When you try and upload a file, it is a straight HTTP upload. PHP plays no part in the actual upload, except for the upload limits set in place by the php settings found in the php.ini or other Apache config files. Now, Apache actually handles the Upload. Once the file has been received completely, Apache then passes the file and process running to PHP. I have never seen a case where Apache has stored the file on the file system. In my past experience it has always held the file in memory, therefor limited to the max physical memory that was install, minus a little for other things. I have worked on Debian (potato|woody|sarge), Redhat 5.0 - 9, Fedora 1 - 7, OpenBSD 3.6-current, and older versions of NetBSD and FreeBSD. I have also frequented a number of friends installs and I have never seen uploads happen any other way. Nor have I heard of uploads happening any other way. Just my 2cents :) -- Jim Lucas Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them. Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Luke Slater
Re: [PHP] A few questions about PHP's SOAP module
On Thu, Aug 7, 2008 at 1:29 PM, Christoph Boget [EMAIL PROTECTED] wrote: * I'm trying to better understand the 'classmap' option for the SoapClient class. Is it used to define the class of an instantiated object which will be passed as an argument to the server's function call? So, as a very simplistic example, it might go something like this: ?php class MyClass { public $sStockSymbol ; public function __construct( $sStockSymbol ) { $this-sStockSymbol = $sStockSymbol; } } $oObj = new MyClass( 'ibm' ); $oClient = new SoapClient( $sWSDL_URI, array( 'classmap' = array( 'StockSymbol' = 'MyClass' ))); $oClient-getStockValue( $oObj ); ? Am I even close? first off, let me recommend the phpt tests in the php source. for the soap stuff, you will find them under ext/soap/tests. i was looking through a few of them. looks like if you have a chunk of wsdl, like this xsd:complexType name=book xsd:all xsd:element name=a type=xsd:string/ xsd:element name=b type=xsd:string/ /xsd:all /xsd:complexType you can map classes to it like this (which i gather you already got) w/ the $options param in the SoapClient constructor class book{ public $a=a; public $b=c; } it looks like you can use contructors too though, im a bit too lazy to hash out the details as i go through the phpt tests =/ but anyway, instead of instantiating book ourselves, the SoapClient instance will do that for us, as in $sc = new SoapClient( $someWsdlAddr, array( 'classmap' = array( 'book' = 'book' ) ) ); $book = $sc-readBook($myFavBook); so assuming there was a method defined in the wsdl, roughly like, ns1:readBook res xsi:type=ns1:book a xsi:type=xsd:stringLord of the Rings/a b xsi:type=xsd:stringJRR Token/b /res /ns1:readBook we could then take the book instance the SoapClient created for us, and do echo title: {$book-a}, author: {$book-b}; /// produces title: Lord of the Rings, author: JRR Token Now, what happens if one of the required arguments to the server function is a variable that has a hyphen in it? Is there any way I can get around that since PHP doesn't allow you to define variables with hyphens? soo, im guessing the wsdl might be something like xsd:complexType name=book xsd:all xsd:element name=a-- type=xsd:string/ xsd:element name=b type=xsd:string/ /xsd:all /xsd:complexType normally, with variable variables, you could hack around this, as in $varWHyphen = 'a--'; $$varWHyphen = 5; however, instance variables cannot be created out of variable variables, so i doubt thats possible in this context. * Whether using class/objects to pass parameters to a server function (assuming I have the above correct) or arrays, how can you define further attributes for each parameter? Is that even possible? well, i think so. basically, i think this feature is just a way to have the SoapClient instantiate an object rather than just returning an array. so the examples in the phpt tests are simple, but you might have a class that actually has methods and so forth, you just use a soap call to create it. then you go on your way. this could be a bit more desireable for some folks than getting an array and using it to create an object themselves, i suppose. so for example in the book class above you might have, public function __toString() { return title: {$this-a}, author: {$this-b}; } So here is an example of a SOAP message that the server is expecting: ?xml version=1.0? soap:Envelope xmlns:soap=http://schemas.xmlsoap.org/soap/envelope/; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xmlns:xsd=http://www.w3.org/2001/XMLSchema; soap:Body ServerFuncName xmlns=urn:/joe/bob/briggs/types String1Var1 Value/String1 String2live/String2 Array1 SubArray1 status=complete SubArray2 xmlns= encoding= node-type= SubArray3 node name=attribute1Node Value/node node name=attribute2Node Value/node node name=attribute3Node Value/node node name=attribute4Node Value/node node name=attribute5Node Value/node /SubArray3 /SubArray2 SubArray2 xmlns= encoding= node-type=/SubArray2 /SubArray1 /Array1 /ServerFuncName /soap:Body /soap:Envelope How can I set up the attributes illustrated above? Encoding, node-type, etc? Is that possible? dunno, maybe scope the phpt tests and see if you can figure something out.. i might play around w/ the example later, but as i said im weak on the actual xml structure of the soap spec. * Finally, is there a really good and/or comprehensive tutorial and/or write-up on PHPs SOAP module? The documentation is pretty spartan and what I have found doesn't really go in to much depth. yea, well, i think we
Re: [PHP] Object overhead vs. arrays
On Thu, Aug 7, 2008 at 7:21 AM, Christoph Boget [EMAIL PROTECTED]wrote: I knew that there would be some overhead when working with objects vs working with arrays, but I didn't expect this much. Is there some optimization that I could do to improve the performance any? While the script below is just a benchmark test script, it approximates functionality that I'm going to need to implement. Ultimately, I need to iterate through a large amount of data and am wondering if perhaps I should encapsulate the data in objects (which closer represents the underlying data) i lost you on this one.. organizing data w/ arrays and objects should be essentially the same thing. they both support name value pairs and nesting. since data doesnt inherently have operations, i dont see how organization could be any better w/ objects (just my opinion). or if I should encapsulate it in arrays. Based on what I'm seeing in this benchmark script, it seems like it should be the latter... so when i tend to design a project, if i plan on using oop, i use oop. some systems might offer options to get back 'only' an array at certain points, as an optimization. however, if i see data and methods realating to one another, i tend to bundle them up in a class. of course you can just use plain old methods and arrays, but then thats a different style of programming. if its any slower, in my mind, i really dont care. i save time and sanity by using the oop techniques i know at design / impl time. soo, maybe more ram and cpu and objects on this one :D -nathan
[PHP] JDBC Wrapper for PHP
Does anyone know of a JDBC API Wrapper that can be called from PHP? I'm already using this to connect to Java: http://php-java-bridge.sourceforge.net/doc/ -- Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Why PHP4?
On 8/7/2008 7:42 PM India Time, _Judson Vaughn_ wrote: Kudos to Richard. If its fixed, don't break it. Jud. == Per Jessen wrote: Richard Heyes wrote: I'm interested - why are people still using PHP4? It's been over 4 years (I think) - plenty of time to upgrade to five. Migration issues for instance - we have quite a bit of code that uses sablotron - in PHP5 that's been changed to libxslt, which requires extensive code-changes. Also, something about setlocale() got regressed (and never fixed) in 4.3.10 or thereabouts, which means we have at least one app that's running on 4.3.8. Finally - why migrate? What's the rush? Lots of people are still running back-level software - e.g. apache, mysql, php, gcc, linux, you name it. *In our shop, migrating working PHP code has one of the lowest priorities*. /Per Jessen, Zürich I was surprised to see some very busy and well to do Chartered Accountants, Company Secretaries still using those 8086 pcs with Wordstar and lotus that were there on mid 80s. They say these are no more available so data in these pcs and these formats are much more safer than that on a latest machine/ software. -- V -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Why PHP4?
You can't steal it, but you can't do anything with it either, so what's the point of having it? Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com V S Rawat wrote: I was surprised to see some very busy and well to do Chartered Accountants, Company Secretaries still using those 8086 pcs with Wordstar and lotus that were there on mid 80s. They say these are no more available so data in these pcs and these formats are much more safer than that on a latest machine/ software. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php File upload
Simple answer is yes. But others might argue this answer. Luke wrote: Tom's machine only has 1 GB of physical memory doesn't it? Could that be the problem? 2008/8/7 Jim Lucas [EMAIL PROTECTED] Tom wrote: Hi, on a linux system (Suese 10.2) with 1 GB memory its not possible to upload via http a 1 Gb File. Thats no limit problem on my php config. i can look the mem stats when uploading and the growing tmp file. If the temp file has 900 MB, Main Memory free is 0 and the script aborts and php deletes the tmp file. Why don't php use swap memory ? Greets Tom After reading this thread, I would like to add my thoughts. What Apache starts, it reads the PHP memory limits in to the running Apache process. When you try and upload a file, it is a straight HTTP upload. PHP plays no part in the actual upload, except for the upload limits set in place by the php settings found in the php.ini or other Apache config files. Now, Apache actually handles the Upload. Once the file has been received completely, Apache then passes the file and process running to PHP. I have never seen a case where Apache has stored the file on the file system. In my past experience it has always held the file in memory, therefor limited to the max physical memory that was install, minus a little for other things. I have worked on Debian (potato|woody|sarge), Redhat 5.0 - 9, Fedora 1 - 7, OpenBSD 3.6-current, and older versions of NetBSD and FreeBSD. I have also frequented a number of friends installs and I have never seen uploads happen any other way. Nor have I heard of uploads happening any other way. Just my 2cents :) -- Jim Lucas Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them. Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Jim Lucas Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them. Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] read a bunch of files that are in many directors into one string
I am trying to read a bunch of files that are in many directors into one string But it will only read one file. Every file is a number 134328923 but they all start with 13 They are in 22 directors named 0 to 22 How can I make the script look in each directory and read each file into a string that is one line after another. There is only one line per file they are email address $file=/remote/0/13*; $data =; $fp = fopen($file, r); while(!feof($fp)) { $data .= fgets($fp, 1024); } echo $data -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] read a bunch of files that are in many directors into one string
First, which version of PHP? PHP 5 added a lot of features for reading files. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Richard Kurth wrote: I am trying to read a bunch of files that are in many directors into one string But it will only read one file. Every file is a number 134328923 but they all start with 13 They are in 22 directors named 0 to 22 How can I make the script look in each directory and read each file into a string that is one line after another. There is only one line per file they are email address $file=/remote/0/13*; $data =; $fp = fopen($file, r); while(!feof($fp)) { $data .= fgets($fp, 1024); } echo $data -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] read a bunch of files that are in many directors into one string
Version 5 First, which version of PHP? PHP 5 added a lot of features for reading files. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Richard Kurth wrote: I am trying to read a bunch of files that are in many directors into one string But it will only read one file. Every file is a number 134328923 but they all start with 13 They are in 22 directors named 0 to 22 How can I make the script look in each directory and read each file into a string that is one line after another. There is only one line per file they are email address $file=/remote/0/13*; $data =; $fp = fopen($file, r); while(!feof($fp)) { $data .= fgets($fp, 1024); } echo $data -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] read a bunch of files that are in many directors into one string
Try this: $rootPath = '/remote'; $string = ''; foreach (0..22 as $dirNum) { $dir = $rootPath/$dirNum; chdir($dir); $files = glob(13*); foreach ($files as $file) { $string .= file_get_contents($file); } } echo $string; Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Richard Kurth wrote: Version 5 First, which version of PHP? PHP 5 added a lot of features for reading files. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Richard Kurth wrote: I am trying to read a bunch of files that are in many directors into one string But it will only read one file. Every file is a number 134328923 but they all start with 13 They are in 22 directors named 0 to 22 How can I make the script look in each directory and read each file into a string that is one line after another. There is only one line per file they are email address $file=/remote/0/13*; $data =; $fp = fopen($file, r); while(!feof($fp)) { $data .= fgets($fp, 1024); } echo $data -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] read a bunch of files that are in many directors into one string
*I get this when I run it Parse error*: syntax error, unexpected T_DNUMBER in *remove.php* on line *4 it does not like the *foreach (0..22 as $dirNum) Try this: $rootPath = '/remote'; $string = ''; foreach (0..22 as $dirNum) { $dir = $rootPath/$dirNum; chdir($dir); $files = glob(13*); foreach ($files as $file) { $string .= file_get_contents($file); } } echo $string; Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Richard Kurth wrote: Version 5 First, which version of PHP? PHP 5 added a lot of features for reading files. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Richard Kurth wrote: I am trying to read a bunch of files that are in many directors into one string But it will only read one file. Every file is a number 134328923 but they all start with 13 They are in 22 directors named 0 to 22 How can I make the script look in each directory and read each file into a string that is one line after another. There is only one line per file they are email address $file=/remote/0/13*; $data =; $fp = fopen($file, r); while(!feof($fp)) { $data .= fgets($fp, 1024); } echo $data -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] read a bunch of files that are in many directors into one string
oops. foreach (range(0..22) as $dirNum) :) Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Richard Kurth wrote: *I get this when I run it Parse error*: syntax error, unexpected T_DNUMBER in *remove.php* on line *4 it does not like the *foreach (0..22 as $dirNum) Try this: $rootPath = '/remote'; $string = ''; foreach (0..22 as $dirNum) { $dir = $rootPath/$dirNum; chdir($dir); $files = glob(13*); foreach ($files as $file) { $string .= file_get_contents($file); } } echo $string; Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Richard Kurth wrote: Version 5 First, which version of PHP? PHP 5 added a lot of features for reading files. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Richard Kurth wrote: I am trying to read a bunch of files that are in many directors into one string But it will only read one file. Every file is a number 134328923 but they all start with 13 They are in 22 directors named 0 to 22 How can I make the script look in each directory and read each file into a string that is one line after another. There is only one line per file they are email address $file=/remote/0/13*; $data =; $fp = fopen($file, r); while(!feof($fp)) { $data .= fgets($fp, 1024); } echo $data -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] read a bunch of files that are in many directors into one string -- oops again
foreach (range(0,22) as $dirNum) Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Richard Kurth wrote: *I get this when I run it Parse error*: syntax error, unexpected T_DNUMBER in *remove.php* on line *4 it does not like the *foreach (0..22 as $dirNum) Try this: $rootPath = '/remote'; $string = ''; foreach (0..22 as $dirNum) { $dir = $rootPath/$dirNum; chdir($dir); $files = glob(13*); foreach ($files as $file) { $string .= file_get_contents($file); } } echo $string; Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Richard Kurth wrote: Version 5 First, which version of PHP? PHP 5 added a lot of features for reading files. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Richard Kurth wrote: I am trying to read a bunch of files that are in many directors into one string But it will only read one file. Every file is a number 134328923 but they all start with 13 They are in 22 directors named 0 to 22 How can I make the script look in each directory and read each file into a string that is one line after another. There is only one line per file they are email address $file=/remote/0/13*; $data =; $fp = fopen($file, r); while(!feof($fp)) { $data .= fgets($fp, 1024); } echo $data -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Why PHP4?
On Thu, 2008-08-07 at 17:29 -0500, Micah Gersten wrote: You can't steal it, but you can't do anything with it either, so what's the point of having it? V S Rawat wrote: I was surprised to see some very busy and well to do Chartered Accountants, Company Secretaries still using those 8086 pcs with Wordstar and lotus that were there on mid 80s. They say these are no more available so data in these pcs and these formats are much more safer than that on a latest machine/ software. I'm calling shenanigans. It was a breeze to setup windows 3.11 WFWG in VMWare. There's a VM for almost every old system these days. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP 4.4.9 Released!
Long live PHP4 *meheheheheh* Cheers, Rob. On Thu, 2008-08-07 at 22:47 +0200, Derick Rethans wrote: Hello, The PHP development team would like to announce the immediate availability of PHP 4.4.9. It continues to improve the security and the stability of the 4.4 branch and all users are strongly encouraged to upgrade to it as soon as possible. This release wraps up all the outstanding patches for the PHP 4.4 series, and is therefore the last PHP 4.4 release. Security Enhancements and Fixes in PHP 4.4.9: * Updated PCRE to version 7.7. * Fixed overflow in memnstr(). * Fixed crash in imageloadfont when an invalid font is given. * Fixed open_basedir handling issue in the curl extension. * Fixed mbstring.func_overload set in .htaccess becomes global. A separate release announcement is also available. For changes in PHP 4.4.9 since PHP 4.4.8, please consult the PHP 4 ChangeLog. Release Announcement: http://www.php.net/release_4_4_9.php Downloads:http://www.php.net/downloads.php#v4 Changelog:http://www.php.net/ChangeLog-4.php#4.4.9 regards, Derick -- http://derickrethans.nl | http://ezcomponents.org | http://xdebug.org -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Kill Magic Quotes
PHP List, I am developing a web site that is hosted on a web server where I do not have permission to change the php.ini file. This server has magic quotes turned on. I'd like them off. I wrote two functions to detect when magic quotes is on, and to try and counter act its effects. But it does not seem to be working. It seems to have no effect, and I get slashes showing up in all sorts of output where I don't want them. Not only in data put into the database, but also emails sent to from the site contact page and other places. Here are the functions I created. Where have I gone wrong? public static function removeSlashes($string) { // Check if Magic Quotes is turned on. if (get_magic_quotes_gpc()) { // Remove escape slashes. return stripslashes($string); } // Return a string that has no escape slashes. return $string; } public static function restoreSlashes($string) { // Check if Magic Quotes is turned on. if (get_magic_quotes_gpc()) { // Add escape slashes. return addslashes($string); } // Return a string that has escape slashes. return $string; } Any advice much appreciated. -- Dave M G -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Kill Magic Quotes
If you can't change php.ini, and if it's Apache, you maybe can just turn it off in .htaccess, far faster and easier than a PHP function. You are calling the removeSlashes, right? And, really, there is no reason for the restoreSlashes function to exist. If you ever think you need it, you're wrong. :-) On Thu, August 7, 2008 10:00 pm, Dave M G wrote: PHP List, I am developing a web site that is hosted on a web server where I do not have permission to change the php.ini file. This server has magic quotes turned on. I'd like them off. I wrote two functions to detect when magic quotes is on, and to try and counter act its effects. But it does not seem to be working. It seems to have no effect, and I get slashes showing up in all sorts of output where I don't want them. Not only in data put into the database, but also emails sent to from the site contact page and other places. Here are the functions I created. Where have I gone wrong? public static function removeSlashes($string) { // Check if Magic Quotes is turned on. if (get_magic_quotes_gpc()) { // Remove escape slashes. return stripslashes($string); } // Return a string that has no escape slashes. return $string; } public static function restoreSlashes($string) { // Check if Magic Quotes is turned on. if (get_magic_quotes_gpc()) { // Add escape slashes. return addslashes($string); } // Return a string that has escape slashes. return $string; } Any advice much appreciated. -- Dave M G -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Some people ask for gifts here. I just want you to buy an Indie CD for yourself: http://cdbaby.com/search/from/lynch -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Kill Magic Quotes
public static function restoreSlashes($string) { // Check if Magic Quotes is turned on. if (get_magic_quotes_gpc()) { // Add escape slashes. return addslashes($string); } // Return a string that has escape slashes. return $string; } Wrong way around. If gpc is enabled, then there are already slashes - no need to add them again. If it's not, you need to addslashes. if (get_magic_quotes_gpc()) { return $string; } return addslashes($string); Though I'm curious why you need to re-add them at all. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] read a bunch of files that are in many directors into one string -- oops again
*Now I get this error Warning*: chdir() [function.chdir]: No error (errno 0) in *C:\web\easycontactpro\removeemail.php* on line *7* Where can I find what errno 0 means it loops through all the directors but does not process any of the files foreach (range(0,22) as $dirNum) Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Richard Kurth wrote: *I get this when I run it Parse error*: syntax error, unexpected T_DNUMBER in *remove.php* on line *4 it does not like the *foreach (0..22 as $dirNum) Try this: $rootPath = '/remote'; $string = ''; foreach (0..22 as $dirNum) { $dir = $rootPath/$dirNum; chdir($dir); $files = glob(13*); foreach ($files as $file) { $string .= file_get_contents($file); } } echo $string; Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Richard Kurth wrote: Version 5 First, which version of PHP? PHP 5 added a lot of features for reading files. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Richard Kurth wrote: I am trying to read a bunch of files that are in many directors into one string But it will only read one file. Every file is a number 134328923 but they all start with 13 They are in 22 directors named 0 to 22 How can I make the script look in each directory and read each file into a string that is one line after another. There is only one line per file they are email address $file=/remote/0/13*; $data =; $fp = fopen($file, r); while(!feof($fp)) { $data .= fgets($fp, 1024); } echo $data -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Kill Magic Quotes
Richard, Thank you for replying. If you can't change php.ini, and if it's Apache, you maybe can just turn it off in .htaccess, far faster and easier than a PHP function. I looked on the web and found this line: php_flag magic_quotes_gpc off ... and added it to my .htaccess file. But it doesn't seem to make a difference. I've set my scripts up so people can embed Google Maps on their pages. The problem I'm seeing now is that the output for the Google Map has all these additional double quotes that I don't know where they are coming from. Maybe it's not a magic quote issue? It looks like this: iframe width=\360\ height=\360\ frameborder=\0\ scrolling=\no\ marginheight=\0\ marginwidth=\0\... (trimmed for brevity) You are calling the removeSlashes, right? I believe I'm calling it everywhere there is some text being inputted or outputted. And, really, there is no reason for the restoreSlashes function to exist. If you ever think you need it, you're wrong. I guess that makes sense. -- Dave M G -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Kill Magic Quotes
you may try the ini_set('magic_quotes_gpc',0); note, this line should be the first line of code. also make sure that that your php opener is the first line in your script. 1. ?PHP 2. ini_set('magic_quotes_gpc',0); 3. # the rest of your script The following won't work 1. 2. ?PHP 3. ini_set('magic_quotes_gpc',0); 4. # the rest of your script Also a heads up for all readers, Warning This feature is DEPRECATED and REMOVED as of PHP 6.0.0. Relying on this feature is highly discouraged in php 6 the quotes will not be magically added. Dave M G wrote: PHP List, I am developing a web site that is hosted on a web server where I do not have permission to change the php.ini file. This server has magic quotes turned on. I'd like them off. I wrote two functions to detect when magic quotes is on, and to try and counter act its effects. But it does not seem to be working. It seems to have no effect, and I get slashes showing up in all sorts of output where I don't want them. Not only in data put into the database, but also emails sent to from the site contact page and other places. Here are the functions I created. Where have I gone wrong? public static function removeSlashes($string) { // Check if Magic Quotes is turned on. if (get_magic_quotes_gpc()) { // Remove escape slashes. return stripslashes($string); } // Return a string that has no escape slashes. return $string; } public static function restoreSlashes($string) { // Check if Magic Quotes is turned on. if (get_magic_quotes_gpc()) { // Add escape slashes. return addslashes($string); } // Return a string that has escape slashes. return $string; } Any advice much appreciated. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Kill Magic Quotes
Roger Bigras wrote: you may try the ini_set('magic_quotes_gpc',0); RTM. http://www.php.net/get_magic_quotes_gpc It cannot be enabled/disabled at run time. It has to either be done in a .htaccess or through apache/php.ini changes. See this page for how to disable it: http://www.php.net/manual/en/security.magicquotes.disabling.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] read a bunch of files that are in many directors into one string -- oops again
Well, make sure $rootPath is correct for your environment. Also, add a slash after the directory name. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Richard Kurth wrote: *Now I get this error Warning*: chdir() [function.chdir]: No error (errno 0) in *C:\web\easycontactpro\removeemail.php* on line *7* Where can I find what errno 0 means it loops through all the directors but does not process any of the files foreach (range(0,22) as $dirNum) Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Richard Kurth wrote: *I get this when I run it Parse error*: syntax error, unexpected T_DNUMBER in *remove.php* on line *4 it does not like the *foreach (0..22 as $dirNum) Try this: $rootPath = '/remote'; $string = ''; foreach (0..22 as $dirNum) { $dir = $rootPath/$dirNum; chdir($dir); $files = glob(13*); foreach ($files as $file) { $string .= file_get_contents($file); } } echo $string; Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Richard Kurth wrote: Version 5 First, which version of PHP? PHP 5 added a lot of features for reading files. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Richard Kurth wrote: I am trying to read a bunch of files that are in many directors into one string But it will only read one file. Every file is a number 134328923 but they all start with 13 They are in 22 directors named 0 to 22 How can I make the script look in each directory and read each file into a string that is one line after another. There is only one line per file they are email address $file=/remote/0/13*; $data =; $fp = fopen($file, r); while(!feof($fp)) { $data .= fgets($fp, 1024); } echo $data -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Kill Magic Quotes
On Fri, Aug 8, 2008 at 9:05 AM, Chris [EMAIL PROTECTED] wrote: http://www.php.net/get_magic_quotes_gpc It cannot be enabled/disabled at run time. It has to either be done in a .htaccess or through apache/php.ini changes. afaik, turning off/on 'magic_quotes_sybase' is a workaround. it overrides the 'magic_quotes_gpc' and can be manipulated through ini_set php.net says magic_quotes_sybaseIf enabled, a single-quote is escaped with a single-quote instead of a backslash. If on, it completely overrides magic_quotes_gpc. Having both directives enabled means only single quotes are escaped as ''. Double quotes, backslashes and NULL's will remain untouched and unescaped. See also ini_get() for retrieving its value. /php.net says ~viraj See this page for how to disable it: http://www.php.net/manual/en/security.magicquotes.disabling.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] read a bunch of files that are in many directors into one string -- oops again
I had to add the full path and it works just fine. Thanks Well, make sure $rootPath is correct for your environment. Also, add a slash after the directory name. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Richard Kurth wrote: *Now I get this error Warning*: chdir() [function.chdir]: No error (errno 0) in *C:\web\easycontactpro\removeemail.php* on line *7* Where can I find what errno 0 means it loops through all the directors but does not process any of the files foreach (range(0,22) as $dirNum) Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Richard Kurth wrote: *I get this when I run it Parse error*: syntax error, unexpected T_DNUMBER in *remove.php* on line *4 it does not like the *foreach (0..22 as $dirNum) Try this: $rootPath = '/remote'; $string = ''; foreach (0..22 as $dirNum) { $dir = $rootPath/$dirNum; chdir($dir); $files = glob(13*); foreach ($files as $file) { $string .= file_get_contents($file); } } echo $string; Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Richard Kurth wrote: Version 5 First, which version of PHP? PHP 5 added a lot of features for reading files. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Richard Kurth wrote: I am trying to read a bunch of files that are in many directors into one string But it will only read one file. Every file is a number 134328923 but they all start with 13 They are in 22 directors named 0 to 22 How can I make the script look in each directory and read each file into a string that is one line after another. There is only one line per file they are email address $file=/remote/0/13*; $data =; $fp = fopen($file, r); while(!feof($fp)) { $data .= fgets($fp, 1024); } echo $data -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Using Ajax to populate a drop-down list
Hi, I have a form with two lists. One is populated with many options while the second is populated with only a single item. When the first drop-down list is changed, I call a PHP script sing AJAX to populate the second list. I also need to perform another task when the second list is changed but it seems not to work. I think this is because even though my AJAX script populates the second drop-down list using pure PHP code, the second drop-down isn't aware of it. I've tries adding JavaScript code in the AJAX route to add options to the list but it's not working. Does anyone have an example of how to do this? Thanks, Don -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Kill Magic Quotes [SOLVED]
Richard, Try php_value instead of php_flag, though both should work for this one. Whoops... my mistake. Without going into overly complicated details, I hadn't tested the original suggestion properly. Turns out, so far as I can tell, both of these lines work for me: php_value magic_quotes_gpc off php_flag magic_quotes_gpc off Right now I'm using php_value, so I'll stick with that. This seems to have solved my magic quotes woes. Thank you Richard, Chris, Roger, Viraj, and the PHP list for responding. -- Dave M G -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Kill Magic Quotes
Dave M G wrote: I am developing a web site that is hosted on a web server where I do not have permission to change the php.ini file. This server has magic quotes turned on. I'd like them off. I wrote two functions to detect when magic quotes is on, and to try and counter act its effects. But it does not seem to be working. It seems to have no effect, and I get slashes showing up in all sorts of output where I don't want them. Not only in data put into the database, but also emails sent to from the site contact page and other places. Perhaps you also need to disable magic_quotes_runtime: set_magic_quotes_runtime(0); // just call it once per page Are you sure you actually call your removeSlashes() function? Why do you think you need your restoreSlashes() function? (NB: not sufficient for MySQL statements, and not applicable for some other databases) Roger Bigras wrote: you may try the ini_set('magic_quotes_gpc',0); That won't work: http://au.php.net/manual/en/function.get-magic-quotes-gpc.php Keep in mind that the setting magic_quotes_gpc will not work at runtime. -- Ross McKay, Toronto, NSW Australia Let the laddie play wi the knife - he'll learn - The Wee Book of Calvin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php