php-general Digest 27 Mar 2010 04:29:17 -0000 Issue 6661
php-general Digest 27 Mar 2010 04:29:17 - Issue 6661 Topics (messages 303497 through 303516): Re: optimizing PHP for microseconds 303497 by: Robert Cummings 303498 by: Per Jessen Re: Will PHP ever grow up and have threading? 303499 by: Per Jessen Re: Zip and text files generated are corrupted 303500 by: Bastien Helders 303501 by: Richard Quadling 303506 by: Bastien Helders 303507 by: Richard Quadling 303514 by: Bastien Helders 303515 by: Richard Quadling Allowing multiple, simultaneous, non-blocking queries. 303502 by: Richard Quadling 303504 by: Peter Lind Moving to Minneapolis... 303503 by: -rada- Re: Authorize.net test 303505 by: David McGlone 303508 by: Robert Cummings Re: Top vs. Bottom Posting 303509 by: tedd How to set Content-type text/plain 303510 by: Guus Ellenkamp 303511 by: Robert Cummings 303512 by: Guus Ellenkamp Re: MySQL: Return Number of Matched Rows 303513 by: Shawn McKenzie Please guide in selection of Framework: according to your experience 303516 by: Vishal Rewari Administrivia: To subscribe to the digest, e-mail: php-general-digest-subscr...@lists.php.net To unsubscribe from the digest, e-mail: php-general-digest-unsubscr...@lists.php.net To post to the list, e-mail: php-gene...@lists.php.net -- ---BeginMessage--- Tommy Pham wrote: On Thu, Mar 25, 2010 at 8:15 PM, Robert Cummings rob...@interjinn.com wrote: Daevid Vincent wrote: -Original Message- From: Robert Cummings [mailto:rob...@interjinn.com] Sent: Thursday, March 25, 2010 7:16 PM Daevid Vincent wrote: If I have to wait 3 seconds for a page to render, that wait is noticeable. Dumb users will click refresh, and since (unbelievably in this day and age) PHP and mySQL don't know the user clicked 'stop' or 'refresh', and therefore mySQL will execute the same query a second time. That's an entirely different thread I've already ranted on about. You may find the following enlightening: http://www.php.net/manual/en/function.ignore-user-abort.php http://www.php.net/manual/en/function.connection-aborted.php http://www.php.net/manual/en/function.connection-status.php Except there is no way to tell mySQL cancel that last request/query. Well, no graceful way. We actually have a script that runs on a crontab and seeks and destroys long running queries. As you may have guessed, just because a query takes a long time, it's difficult to know if it's actually hung or just really taking that long. So we do some smarts to compare against others and see if it seems like the same one and stuff like that. Not great, but sure stops the load from shooting through the roof. Again, not going into the rant I've done before. Look in the archives 2009-06-02 for Why doesn't mySQL stop a query when the browser tab is closed for that thread and even more indepth info on the my...@lists.mysql.com archives (same date and subject). That's a good point about MySQL, and in fact PHP would probably keep running too until MySQL returned. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP What about 'SHOW FULL PROCESSLIST' and look through the 'INFO' for that last matching query statement and kill the process? This is possible but then you don't know whose query you are killing. A terminated PHP process or a actively running PHP process with a connected user awaiting output. However, you could track PHP process IDs and MySQL process IDs (via mysql_thread_id()) to know whose MySQL process you are killing. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP ---End Message--- ---BeginMessage--- Daevid Vincent wrote: Was that someone me? I do that. And if you don't, then you're the kind of person I would not hire (not saying that to sound mean). If you do, I'd would be careful about hiring you. To me, optimizing for microseconds in PHP means loss of focus. I use single quotes instead of double where applicable. I use -- instead of ++. I use $boolean = !$boolean to alternate (instead of mod() or other incrementing solutions). I use LIMIT 1 on select, update, delete where appropriate. I use the session to cache the user and even query results. Most of that is just sound practice, not optimizing, imho. Optimizing is what you do later. I come from the video game world where gaining a frame or two of animation per second matters. It makes your game feel less choppy and more fluid and therefore more fun to play. Well, if you were writing PHP video games, I can totally appreciate optimizing for microseconds. -- Per Jessen, Zürich (11.4°C) ---End Message--- ---BeginMessage--- Peter Lind wrote: Anyway, I don't think either of us will change point of view much at
Re: [PHP] RE: optimizing PHP for microseconds
On Thu, Mar 25, 2010 at 8:15 PM, Robert Cummings rob...@interjinn.com wrote: Daevid Vincent wrote: -Original Message- From: Robert Cummings [mailto:rob...@interjinn.com] Sent: Thursday, March 25, 2010 7:16 PM Daevid Vincent wrote: If I have to wait 3 seconds for a page to render, that wait is noticeable. Dumb users will click refresh, and since (unbelievably in this day and age) PHP and mySQL don't know the user clicked 'stop' or 'refresh', and therefore mySQL will execute the same query a second time. That's an entirely different thread I've already ranted on about. You may find the following enlightening: http://www.php.net/manual/en/function.ignore-user-abort.php http://www.php.net/manual/en/function.connection-aborted.php http://www.php.net/manual/en/function.connection-status.php Except there is no way to tell mySQL cancel that last request/query. Well, no graceful way. We actually have a script that runs on a crontab and seeks and destroys long running queries. As you may have guessed, just because a query takes a long time, it's difficult to know if it's actually hung or just really taking that long. So we do some smarts to compare against others and see if it seems like the same one and stuff like that. Not great, but sure stops the load from shooting through the roof. Again, not going into the rant I've done before. Look in the archives 2009-06-02 for Why doesn't mySQL stop a query when the browser tab is closed for that thread and even more indepth info on the my...@lists.mysql.com archives (same date and subject). That's a good point about MySQL, and in fact PHP would probably keep running too until MySQL returned. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP What about 'SHOW FULL PROCESSLIST' and look through the 'INFO' for that last matching query statement and kill the process? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] RE: optimizing PHP for microseconds
Tommy Pham wrote: On Thu, Mar 25, 2010 at 8:15 PM, Robert Cummings rob...@interjinn.com wrote: Daevid Vincent wrote: -Original Message- From: Robert Cummings [mailto:rob...@interjinn.com] Sent: Thursday, March 25, 2010 7:16 PM Daevid Vincent wrote: If I have to wait 3 seconds for a page to render, that wait is noticeable. Dumb users will click refresh, and since (unbelievably in this day and age) PHP and mySQL don't know the user clicked 'stop' or 'refresh', and therefore mySQL will execute the same query a second time. That's an entirely different thread I've already ranted on about. You may find the following enlightening: http://www.php.net/manual/en/function.ignore-user-abort.php http://www.php.net/manual/en/function.connection-aborted.php http://www.php.net/manual/en/function.connection-status.php Except there is no way to tell mySQL cancel that last request/query. Well, no graceful way. We actually have a script that runs on a crontab and seeks and destroys long running queries. As you may have guessed, just because a query takes a long time, it's difficult to know if it's actually hung or just really taking that long. So we do some smarts to compare against others and see if it seems like the same one and stuff like that. Not great, but sure stops the load from shooting through the roof. Again, not going into the rant I've done before. Look in the archives 2009-06-02 for Why doesn't mySQL stop a query when the browser tab is closed for that thread and even more indepth info on the my...@lists.mysql.com archives (same date and subject). That's a good point about MySQL, and in fact PHP would probably keep running too until MySQL returned. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP What about 'SHOW FULL PROCESSLIST' and look through the 'INFO' for that last matching query statement and kill the process? This is possible but then you don't know whose query you are killing. A terminated PHP process or a actively running PHP process with a connected user awaiting output. However, you could track PHP process IDs and MySQL process IDs (via mysql_thread_id()) to know whose MySQL process you are killing. 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] RE: optimizing PHP for microseconds
Daevid Vincent wrote: Was that someone me? I do that. And if you don't, then you're the kind of person I would not hire (not saying that to sound mean). If you do, I'd would be careful about hiring you. To me, optimizing for microseconds in PHP means loss of focus. I use single quotes instead of double where applicable. I use -- instead of ++. I use $boolean = !$boolean to alternate (instead of mod() or other incrementing solutions). I use LIMIT 1 on select, update, delete where appropriate. I use the session to cache the user and even query results. Most of that is just sound practice, not optimizing, imho. Optimizing is what you do later. I come from the video game world where gaining a frame or two of animation per second matters. It makes your game feel less choppy and more fluid and therefore more fun to play. Well, if you were writing PHP video games, I can totally appreciate optimizing for microseconds. -- Per Jessen, Zürich (11.4°C) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Will PHP ever grow up and have threading?
Peter Lind wrote: Anyway, I don't think either of us will change point of view much at this point - so we should probably just give the mailing list a rest by now. Thanks for the posts, it's been interesting to read :) Most of it. +1 -- Per Jessen, Zürich (11.6°C) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP]Zip and text files generated are corrupted
I've already specified the outputs, and it doesn't change if I put it in a file. 1)In the first scenario, where all the data are compressed together, the only call of exec('zip') give this output: OUTPUT adding: bin/ (stored 0%) adding: bin/startHotFixInstaller.bat (deflated 41%) adding: bin/startHotFixInstaller.sh (deflated 49%) adding: software/ (stored 0%) adding: software/hotfixes/ (stored 0%) adding: software/hotfixes/hfFolder/ (stored 0%) [snip] adding: software/hotfixes/hfFolder/Patch-632Q3-033/Server/lib/julia.jar (deflated 4%) adding: software/hotfixes/hfFolder/Patch-632Q3-033/Server/software/ /OUTPUT I snipped the output because it is a lot of the same, but, you'll notice that in the last line, the status of the file between parenthesis is missing, which leads me to think it has been interrupted. I've made a few research in between.Of note, the status with which he exited. Status 14 for the zip command means error writing to a file. But it isn't always at the same files. Also, I upped the value of max_input_time in php.ini from 60 to 600. Before the change the exec instructions took about 60 seconds before interrupting, after it takes about 180-200 seconds and not 600 as expected. 2)In the second scenario, as said, I copy the previous patch (P14, which itself is a behemoth of a zip archive that was manually assembled) and then add and delete only a few folders, each calling the function exec('zip...'). Each time it ends with status 2, which means unexpected end of zip files. And there is no output to each of those commands. As for the single exec('zip..') in 1), the copy() of the previous patch took about 60 seconds before the php.ini change and about 180-200 seconds after. I take it that the copy() is interrupted thus explaining the unexpected end of zip files (I can open the original patch P14 without any problem). I hope I made myself more clear on the details of my problem. Best Regards, Bastien 2010/3/25 Richard Quadling rquadl...@googlemail.com On 25 March 2010 13:31, Bastien Helders eldroskan...@gmail.com wrote: I'm really stumped, it seems that although the script is running under the time limit, if a single instruction such as exec(zip) in the first case, or copy() in the second case are timing out, because it takes too much time processing the big file. Is there any configuration in php.ini (or anywhere else) that I could change to permit copy() or exec(zip) to run through without being interrupted? Regards, Bastien What is the output of the exec when the command fails? Not the return value of exec() which is the last line, but the whole thing, which is returned in the second parameter. If you can't see it due to pushing the file as part of the script, then try something like ... exec('zip ', $Output); file_put_contents('./ZipResults.txt', $Output); -- - Richard Quadling Standing on the shoulders of some very clever giants! EE : http://www.experts-exchange.com/M_248814.html EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731 ZOPA : http://uk.zopa.com/member/RQuadling -- haXe - an open source web programming language http://haxe.org
Re: [PHP]Zip and text files generated are corrupted
On 26 March 2010 08:51, Bastien Helders eldroskan...@gmail.com wrote: I've already specified the outputs, and it doesn't change if I put it in a file. 1)In the first scenario, where all the data are compressed together, the only call of exec('zip') give this output: OUTPUT adding: bin/ (stored 0%) adding: bin/startHotFixInstaller.bat (deflated 41%) adding: bin/startHotFixInstaller.sh (deflated 49%) adding: software/ (stored 0%) adding: software/hotfixes/ (stored 0%) adding: software/hotfixes/hfFolder/ (stored 0%) [snip] adding: software/hotfixes/hfFolder/Patch-632Q3-033/Server/lib/julia.jar (deflated 4%) adding: software/hotfixes/hfFolder/Patch-632Q3-033/Server/software/ /OUTPUT I snipped the output because it is a lot of the same, but, you'll notice that in the last line, the status of the file between parenthesis is missing, which leads me to think it has been interrupted. I've made a few research in between.Of note, the status with which he exited. Status 14 for the zip command means error writing to a file. But it isn't always at the same files. Also, I upped the value of max_input_time in php.ini from 60 to 600. Before the change the exec instructions took about 60 seconds before interrupting, after it takes about 180-200 seconds and not 600 as expected. 2)In the second scenario, as said, I copy the previous patch (P14, which itself is a behemoth of a zip archive that was manually assembled) and then add and delete only a few folders, each calling the function exec('zip...'). Each time it ends with status 2, which means unexpected end of zip files. And there is no output to each of those commands. As for the single exec('zip..') in 1), the copy() of the previous patch took about 60 seconds before the php.ini change and about 180-200 seconds after. I take it that the copy() is interrupted thus explaining the unexpected end of zip files (I can open the original patch P14 without any problem). I hope I made myself more clear on the details of my problem. Best Regards, Bastien 2010/3/25 Richard Quadling rquadl...@googlemail.com On 25 March 2010 13:31, Bastien Helders eldroskan...@gmail.com wrote: I'm really stumped, it seems that although the script is running under the time limit, if a single instruction such as exec(zip) in the first case, or copy() in the second case are timing out, because it takes too much time processing the big file. Is there any configuration in php.ini (or anywhere else) that I could change to permit copy() or exec(zip) to run through without being interrupted? Regards, Bastien What is the output of the exec when the command fails? Not the return value of exec() which is the last line, but the whole thing, which is returned in the second parameter. If you can't see it due to pushing the file as part of the script, then try something like ... exec('zip ', $Output); file_put_contents('./ZipResults.txt', $Output); -- - Richard Quadling Standing on the shoulders of some very clever giants! EE : http://www.experts-exchange.com/M_248814.html EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731 ZOPA : http://uk.zopa.com/member/RQuadling -- haXe - an open source web programming language http://haxe.org I _think_ that the $Output will only hold STDOUT and not STDERR. Can you try this ... exec(zip 21, $Output); Also, error_reporting(-1); // Show ALL errors/warnings/notices. ini_set('display_errors', 1); // Display them. set_time_limit(0); // Allow run forever -- - Richard Quadling Standing on the shoulders of some very clever giants! EE : http://www.experts-exchange.com/M_248814.html EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731 ZOPA : http://uk.zopa.com/member/RQuadling -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Allowing multiple, simultaneous, non-blocking queries.
Hi. As I understand things, one of the main issues in the When will PHP grow up thread was the ability to issue multiple queries in parallel via some sort of threading mechanism. Due to the complete overhaul required of the core and extensions to support userland threading, the general consensus was a big fat No!. As I understand things, it is possible, in userland, to use multiple, non-blocking sockets for file I/O (something I don't seem to be able to achieve on Windows http://bugs.php.net/bug.php?id=47918). Can this process be leveraged to allow for non-blocking queries? Being able to throw out multiple non-blocking queries would allow for the queries in parallel issue. My understanding is that at the base level, all queries are running on a socket in some way, so isn't this facility nearly already there in some way? Regards, Richard. -- - Richard Quadling Standing on the shoulders of some very clever giants! EE : http://www.experts-exchange.com/M_248814.html EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731 ZOPA : http://uk.zopa.com/member/RQuadling -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Moving to Minneapolis...
Anyone reading this from Twin Cities? I just bought a home there, moving by the end of April or sooner, would really appreciate any job leads or advice! LinkedIn Resume http://www.linkedin.com/in/rvarshavskaya Here are some more specific specific questions I have - please feel free to take this offline, it's probably too boring for a general discussion :) * Where to look? The usual job boards seem to be dominated by Microsoft stack postings. Where are all the PHP jobs? * What is the compensation range for senior LAMP developers, either hourly or full-time? I know I won't make what I have been making in New York... where should I set my expectations? * What is the mix in terms of companies vs agencies vs startups? * Any GOOD recruiters? Local PHP lists? Thanks in advance for any help!
Re: [PHP] Allowing multiple, simultaneous, non-blocking queries.
Hi Richard At the end of discussion, the best bet for something that approaches a threaded version of multiple queries would be something like: 1. open connection to database 2. issue query using asynchronous call (mysql and postgresql support this, haven't checked the others) 3. pick up result when ready To get the threaded-ness, just open a connection per query you want to run asynchronous and pick it up when you're ready for it - i.e. iterate over steps 1-2, then do step 3 when things are ready. Regards Peter On 26 March 2010 12:45, Richard Quadling rquadl...@googlemail.com wrote: Hi. As I understand things, one of the main issues in the When will PHP grow up thread was the ability to issue multiple queries in parallel via some sort of threading mechanism. Due to the complete overhaul required of the core and extensions to support userland threading, the general consensus was a big fat No!. As I understand things, it is possible, in userland, to use multiple, non-blocking sockets for file I/O (something I don't seem to be able to achieve on Windows http://bugs.php.net/bug.php?id=47918). Can this process be leveraged to allow for non-blocking queries? Being able to throw out multiple non-blocking queries would allow for the queries in parallel issue. My understanding is that at the base level, all queries are running on a socket in some way, so isn't this facility nearly already there in some way? Regards, Richard. -- - Richard Quadling Standing on the shoulders of some very clever giants! EE : http://www.experts-exchange.com/M_248814.html EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731 ZOPA : http://uk.zopa.com/member/RQuadling -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- hype WWW: http://plphp.dk / http://plind.dk LinkedIn: http://www.linkedin.com/in/plind Flickr: http://www.flickr.com/photos/fake51 BeWelcome: Fake51 Couchsurfing: Fake51 /hype -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Authorize.net test
On Thu, Mar 25, 2010 at 08:45:19PM -0400, David McGlone wrote: Does anyone have any experience with authorize.net? I have a test account with authorize.net and I have written a script to use the checkout of authorize.net but I keep getting this error: 3|2|13|The merchant login ID or password is invalid or the account is inactive.||P|0|||45.99||auth_capture|| C6625114C7C848C859D5D0C446C1F7CE|| and this error: 3|2|13|The merchant login ID or password is invalid or the account is inactive.||P|0|||0.00||auth_capture|| F68A9C87C1E1472521704EF38C21F647|| I have checked and rechecked my login ID and password with no results. The code is spread across 3 files config.php, authorize_net_request.php, and test_authorize_net.php and I have posted these files to pastebin because I didn't know if I could post the code here. Could someone give these files a look over and see what I've done wrong? The pastebin URL is: http://pastebin.com/5xacghDR Last time I encountered an error like this with an e-gateway, the problem was that, despite what I thought, the account was actually inactive. It wasn't authorize.net, but I'm betting that your gateway ID and password are fine, just like mine were. I had to call them to find out the account was, for some reason, deemed inactive. Thank you Paul. I'm going to check into that. I was thinking I typed something wrong. I compared my pages of code to the code in the book and couldn't find anything, so I started wondering if the book was even correct. Another thing I find odd that makes me wonder if I did this correctly is when I compare the error I get with my test transaction to the successful test transaction in the book, I notice it says auth_only on the left side and prior_auth_capture on the right side but, both of mine says auth_capture I found the example I'm working on at google books here's the link: http://books.google.com/books?id=J5AIx8AFnAICprintsec=frontcoverdq=beginning+php+and+mysql+e- commerce+from+novice+to+professional+second+editioncd=1#v=onepageq=beginning%20php%20and%20mysql%20e- commerce%20from%20novice%20to%20professional%20second%20editionf=false It is on page 646 -- Blessings David M. I have been driven to my knees many times by the overwhelming conviction that I had nowhere else to go. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP]Zip and text files generated are corrupted
I already used error_reporting and set_time_limit and the use of ini_set('display_errors', 1); didn't display more exceptions. However the modification in the exec helped display STDERR I think. 1) In the first scenario we have the following: STDERR zip warning: ../../build/Patch-6-3-2_Q3P15.zip not found or empty zip error: Internal logic error (write error on zip file) /STDERR The funny thing is, that now it is throwing status 5: a severe error in the zipfile format was detected. Processing probably failed immediately. Why It throw a status 5 instead of a status 14, I can't say. So that's using 'zip -gr', when I stop using the option g and then call exec('zip -r ...'), then I only get: STDERR zip error: Internal logic error (write error on zip file) /STDERR 2) The error messages of the second scenario doesn't surprise me much: STDERR zip error: Unexpected end of zip file (build/Patch-6-3-2_Q3P15.zip) /STDERR Which was already known, as the call of copy() on the old patch P14 crop it and thus prevent any operation to be done on it. 2010/3/26 Richard Quadling rquadl...@googlemail.com On 26 March 2010 08:51, Bastien Helders eldroskan...@gmail.com wrote: I've already specified the outputs, and it doesn't change if I put it in a file. 1)In the first scenario, where all the data are compressed together, the only call of exec('zip') give this output: OUTPUT adding: bin/ (stored 0%) adding: bin/startHotFixInstaller.bat (deflated 41%) adding: bin/startHotFixInstaller.sh (deflated 49%) adding: software/ (stored 0%) adding: software/hotfixes/ (stored 0%) adding: software/hotfixes/hfFolder/ (stored 0%) [snip] adding: software/hotfixes/hfFolder/Patch-632Q3-033/Server/lib/julia.jar (deflated 4%) adding: software/hotfixes/hfFolder/Patch-632Q3-033/Server/software/ /OUTPUT I snipped the output because it is a lot of the same, but, you'll notice that in the last line, the status of the file between parenthesis is missing, which leads me to think it has been interrupted. I've made a few research in between.Of note, the status with which he exited. Status 14 for the zip command means error writing to a file. But it isn't always at the same files. Also, I upped the value of max_input_time in php.ini from 60 to 600. Before the change the exec instructions took about 60 seconds before interrupting, after it takes about 180-200 seconds and not 600 as expected. 2)In the second scenario, as said, I copy the previous patch (P14, which itself is a behemoth of a zip archive that was manually assembled) and then add and delete only a few folders, each calling the function exec('zip...'). Each time it ends with status 2, which means unexpected end of zip files. And there is no output to each of those commands. As for the single exec('zip..') in 1), the copy() of the previous patch took about 60 seconds before the php.ini change and about 180-200 seconds after. I take it that the copy() is interrupted thus explaining the unexpected end of zip files (I can open the original patch P14 without any problem). I hope I made myself more clear on the details of my problem. Best Regards, Bastien 2010/3/25 Richard Quadling rquadl...@googlemail.com On 25 March 2010 13:31, Bastien Helders eldroskan...@gmail.com wrote: I'm really stumped, it seems that although the script is running under the time limit, if a single instruction such as exec(zip) in the first case, or copy() in the second case are timing out, because it takes too much time processing the big file. Is there any configuration in php.ini (or anywhere else) that I could change to permit copy() or exec(zip) to run through without being interrupted? Regards, Bastien What is the output of the exec when the command fails? Not the return value of exec() which is the last line, but the whole thing, which is returned in the second parameter. If you can't see it due to pushing the file as part of the script, then try something like ... exec('zip ', $Output); file_put_contents('./ZipResults.txt', $Output); -- - Richard Quadling Standing on the shoulders of some very clever giants! EE : http://www.experts-exchange.com/M_248814.html EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731 ZOPA : http://uk.zopa.com/member/RQuadling -- haXe - an open source web programming language http://haxe.org I _think_ that the $Output will only hold STDOUT and not STDERR. Can you try this ... exec(zip 21, $Output); Also, error_reporting(-1); // Show ALL errors/warnings/notices. ini_set('display_errors', 1); // Display them. set_time_limit(0); // Allow run forever -- - Richard Quadling Standing on the shoulders of some very clever giants! EE :
Re: [PHP]Zip and text files generated are corrupted
On 26 March 2010 12:21, Bastien Helders eldroskan...@gmail.com wrote: I already used error_reporting and set_time_limit and the use of ini_set('display_errors', 1); didn't display more exceptions. However the modification in the exec helped display STDERR I think. 1) In the first scenario we have the following: STDERR zip warning: ../../build/Patch-6-3-2_Q3P15.zip not found or empty zip error: Internal logic error (write error on zip file) /STDERR The funny thing is, that now it is throwing status 5: a severe error in the zipfile format was detected. Processing probably failed immediately. Why It throw a status 5 instead of a status 14, I can't say. So that's using 'zip -gr', when I stop using the option g and then call exec('zip -r ...'), then I only get: STDERR zip error: Internal logic error (write error on zip file) /STDERR 2) The error messages of the second scenario doesn't surprise me much: STDERR zip error: Unexpected end of zip file (build/Patch-6-3-2_Q3P15.zip) /STDERR Which was already known, as the call of copy() on the old patch P14 crop it and thus prevent any operation to be done on it. So, the error is in the execution of the exec. Can you run the exec twice but to 2 different zip files. If the issue is that PHP is timing out, then the first error COULD be due to the process being killed and if so, the second one won't start. But if the second one starts, then that pretty much rules out PHP timeouts. I assume you've checked disk space and read access to the files in question? i.e. they aren't locked by another user? -- - Richard Quadling Standing on the shoulders of some very clever giants! EE : http://www.experts-exchange.com/M_248814.html EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731 ZOPA : http://uk.zopa.com/member/RQuadling -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Authorize.net test
David McGlone wrote: On Thu, Mar 25, 2010 at 08:45:19PM -0400, David McGlone wrote: Does anyone have any experience with authorize.net? I have a test account with authorize.net and I have written a script to use the checkout of authorize.net but I keep getting this error: 3|2|13|The merchant login ID or password is invalid or the account is inactive.||P|0|||45.99||auth_capture|| C6625114C7C848C859D5D0C446C1F7CE|| and this error: 3|2|13|The merchant login ID or password is invalid or the account is inactive.||P|0|||0.00||auth_capture|| F68A9C87C1E1472521704EF38C21F647|| I have checked and rechecked my login ID and password with no results. The code is spread across 3 files config.php, authorize_net_request.php, and test_authorize_net.php and I have posted these files to pastebin because I didn't know if I could post the code here. Could someone give these files a look over and see what I've done wrong? The pastebin URL is: http://pastebin.com/5xacghDR Last time I encountered an error like this with an e-gateway, the problem was that, despite what I thought, the account was actually inactive. It wasn't authorize.net, but I'm betting that your gateway ID and password are fine, just like mine were. I had to call them to find out the account was, for some reason, deemed inactive. Thank you Paul. I'm going to check into that. I was thinking I typed something wrong. I compared my pages of code to the code in the book and couldn't find anything, so I started wondering if the book was even correct. Another thing I find odd that makes me wonder if I did this correctly is when I compare the error I get with my test transaction to the successful test transaction in the book, I notice it says auth_only on the left side and prior_auth_capture on the right side but, both of mine says auth_capture I found the example I'm working on at google books here's the link: http://books.google.com/books?id=J5AIx8AFnAICprintsec=frontcoverdq=beginning+php+and+mysql+e- commerce+from+novice+to+professional+second+editioncd=1#v=onepageq=beginning%20php%20and%20mysql%20e- commerce%20from%20novice%20to%20professional%20second%20editionf=false It is on page 646 Could it be that you have the config not set to test mode but you are connecting via the test URL? 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] Top vs. Bottom Posting
-Original Message- From: tedd [mailto:tedd.sperl...@gmail.com] You didn't used to be so difficult, what changed? (look I'm bottom posting!) I wasn't trying to be difficult! Honest! Yousif hijacked my thread to tell me to bottom post. I did the right thing IMHO, and split to a brand new message/thread (to keep the 'thread' thread on track), with relevant subject line, and gave my retort as to why I don't agree and why I prefer top posting. I didn't intend for it to be the same tired top/bottom post argument we've seen numerous times in the decade or so I've been on this list. But I have to say, I'm a little bit honored and flattered even, that the legendary Tedd Sperling even knows who I am let alone takes note of how I used to be. :) That makes my day! d Daevid: I'm not a legend -- I'm just a programmer trying to keep up. As for my comment -- you've been around long enough to prove your worth and provide ample support for your various positions, I just found it odd that you would waste your talent tilting such trivial windmills? I concluded that something else must be at play here. As is all too common, I may be wrong. 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
[PHP] How to set Content-type text/plain
I have the following lines in my PHP code: header('Content-type: text/plain; charset=utf-8'); echo 'Invalid command'; However, the output is: HTTP/1.1 200 OK Date: Fri, 26 Mar 2010 13:30:08 GMT Server: Apache/2.0.55 (Win32) PHP/5.1.4 X-Powered-By: PHP/5.1.4 Set-Cookie: http://groepskorting.megaheights.net_sfx=j1cujiemeelf4iqpepqlqub5n3; path=/ Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma: no-cache Set-Cookie: 98defd6ee70dfb1dea416cecdf391f58=-; path=/ Content-Length: 13 Content-Type: text/html Invalid task Why is the Content-Type text/html and not text/plain? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to set Content-type text/plain
Guus Ellenkamp wrote: I have the following lines in my PHP code: header('Content-type: text/plain; charset=utf-8'); echo 'Invalid command'; However, the output is: HTTP/1.1 200 OK Date: Fri, 26 Mar 2010 13:30:08 GMT Server: Apache/2.0.55 (Win32) PHP/5.1.4 X-Powered-By: PHP/5.1.4 Set-Cookie: http://groepskorting.megaheights.net_sfx=j1cujiemeelf4iqpepqlqub5n3; path=/ Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma: no-cache Set-Cookie: 98defd6ee70dfb1dea416cecdf391f58=-; path=/ Content-Length: 13 Content-Type: text/html Invalid task Why is the Content-Type text/html and not text/plain? Is another header sent later in the program flow? It would supercede previous headers. Try setting the replace parameter in the call to false and then check the head response. 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] How to set Content-type text/plain
Sorry, my mistake... Never trapped a computer on this kind of mistakes. I never arrived at those lines hehehehe. Sorry. Robert, thanks, you brought the idea to check further. Robert Cummings rob...@interjinn.com wrote in message news:4bacba3f.6050...@interjinn.com... Guus Ellenkamp wrote: I have the following lines in my PHP code: header('Content-type: text/plain; charset=utf-8'); echo 'Invalid command'; However, the output is: HTTP/1.1 200 OK Date: Fri, 26 Mar 2010 13:30:08 GMT Server: Apache/2.0.55 (Win32) PHP/5.1.4 X-Powered-By: PHP/5.1.4 Set-Cookie: http://groepskorting.megaheights.net_sfx=j1cujiemeelf4iqpepqlqub5n3; path=/ Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma: no-cache Set-Cookie: 98defd6ee70dfb1dea416cecdf391f58=-; path=/ Content-Length: 13 Content-Type: text/html Invalid task Why is the Content-Type text/html and not text/plain? Is another header sent later in the program flow? It would supercede previous headers. Try setting the replace parameter in the call to false and then check the head response. 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
[PHP] Re: MySQL: Return Number of Matched Rows
James Colannino wrote: Hey everyone, I have a question. If I do a mysql query that updates a column in a row to the same value, I get 0 rows affected. However, I also get 1 or more matched rows. Is there a way that I can return the number of matched rows, rather than the number of rows affected? I'm trying to get something done with as few SQL queries as possible. Thanks! James If it works in your situation you can use REPLACE instead of UPDATE and the mysql_affected_rows() should work. You may need to divide this number by 2 as I think it counts the deletes and inserts. -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP]Zip and text files generated are corrupted
I have checked the rights on the file for the first scenario and no user as locked it, I can see it, read it and write into it. I could even delete it if I wanted. For the second scenario, it doesn't even apply, as the exec('zip') that timeout try to create a new file (naturally in a folder where the web app user has all the necessary rights) In both case, it is no PHP timeout, as after the copy() in the first scenario, and the exec('zip') in the second scenario, the script continue to execute the other instructions, although the manipulation of the big files fails. But if it is not a PHP timeout, what is it? 2010/3/26 Richard Quadling rquadl...@googlemail.com On 26 March 2010 12:21, Bastien Helders eldroskan...@gmail.com wrote: I already used error_reporting and set_time_limit and the use of ini_set('display_errors', 1); didn't display more exceptions. However the modification in the exec helped display STDERR I think. 1) In the first scenario we have the following: STDERR zip warning: ../../build/Patch-6-3-2_Q3P15.zip not found or empty zip error: Internal logic error (write error on zip file) /STDERR The funny thing is, that now it is throwing status 5: a severe error in the zipfile format was detected. Processing probably failed immediately. Why It throw a status 5 instead of a status 14, I can't say. So that's using 'zip -gr', when I stop using the option g and then call exec('zip -r ...'), then I only get: STDERR zip error: Internal logic error (write error on zip file) /STDERR 2) The error messages of the second scenario doesn't surprise me much: STDERR zip error: Unexpected end of zip file (build/Patch-6-3-2_Q3P15.zip) /STDERR Which was already known, as the call of copy() on the old patch P14 crop it and thus prevent any operation to be done on it. So, the error is in the execution of the exec. Can you run the exec twice but to 2 different zip files. If the issue is that PHP is timing out, then the first error COULD be due to the process being killed and if so, the second one won't start. But if the second one starts, then that pretty much rules out PHP timeouts. I assume you've checked disk space and read access to the files in question? i.e. they aren't locked by another user? -- - Richard Quadling Standing on the shoulders of some very clever giants! EE : http://www.experts-exchange.com/M_248814.html EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731 ZOPA : http://uk.zopa.com/member/RQuadling -- haXe - an open source web programming language http://haxe.org
Re: [PHP]Zip and text files generated are corrupted
On 26 March 2010 15:20, Bastien Helders eldroskan...@gmail.com wrote: I have checked the rights on the file for the first scenario and no user as locked it, I can see it, read it and write into it. I could even delete it if I wanted. For the second scenario, it doesn't even apply, as the exec('zip') that timeout try to create a new file (naturally in a folder where the web app user has all the necessary rights) In both case, it is no PHP timeout, as after the copy() in the first scenario, and the exec('zip') in the second scenario, the script continue to execute the other instructions, although the manipulation of the big files fails. But if it is not a PHP timeout, what is it? 2010/3/26 Richard Quadling rquadl...@googlemail.com On 26 March 2010 12:21, Bastien Helders eldroskan...@gmail.com wrote: I already used error_reporting and set_time_limit and the use of ini_set('display_errors', 1); didn't display more exceptions. However the modification in the exec helped display STDERR I think. 1) In the first scenario we have the following: STDERR zip warning: ../../build/Patch-6-3-2_Q3P15.zip not found or empty zip error: Internal logic error (write error on zip file) /STDERR The funny thing is, that now it is throwing status 5: a severe error in the zipfile format was detected. Processing probably failed immediately. Why It throw a status 5 instead of a status 14, I can't say. So that's using 'zip -gr', when I stop using the option g and then call exec('zip -r ...'), then I only get: STDERR zip error: Internal logic error (write error on zip file) /STDERR 2) The error messages of the second scenario doesn't surprise me much: STDERR zip error: Unexpected end of zip file (build/Patch-6-3-2_Q3P15.zip) /STDERR Which was already known, as the call of copy() on the old patch P14 crop it and thus prevent any operation to be done on it. So, the error is in the execution of the exec. Can you run the exec twice but to 2 different zip files. If the issue is that PHP is timing out, then the first error COULD be due to the process being killed and if so, the second one won't start. But if the second one starts, then that pretty much rules out PHP timeouts. I assume you've checked disk space and read access to the files in question? i.e. they aren't locked by another user? -- - Richard Quadling Standing on the shoulders of some very clever giants! EE : http://www.experts-exchange.com/M_248814.html EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731 ZOPA : http://uk.zopa.com/member/RQuadling -- haXe - an open source web programming language http://haxe.org I'm not sure. What is the exact command you are using? I wonder if the zipArchive route would be easier. According to the documentation, both Apache and IIS have similar timeout values ... Your web server can have other timeout configurations that may also interrupt PHP execution. Apache has a Timeout directive and IIS has a CGI timeout function. Both default to 300 seconds. See your web server documentation for specific details. (http://docs.php.net/manual/en/info.configuration.php#ini.max-execution-time) Can you run the command from the shell directly without any problems. And run it repeatedly. -- - Richard Quadling Standing on the shoulders of some very clever giants! EE : http://www.experts-exchange.com/M_248814.html EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731 ZOPA : http://uk.zopa.com/member/RQuadling -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Please guide in selection of Framework: according to your experience
Dear PHP community, I am vishal, I have recently started development in PHP I have come across these PHP frameworks: 1. Codeigniter 2. Symphony 3. CakePHP 4. PEAR Please guide me which one of them is *good in performance ? available functionality ? Easy to use and configure* or the one you would recommend according to your experience. My DB is MySQl, or should I stick to native call from PHP? -- -- Warm Regards Vishal Rewari Student - LD College of Engineering, AIESEC - Ahmedabad. --- AIESEC - vishal.rew...@aiesec.net Gmail - rewari.vis...@gmail.com Skype- vishal.rewari Mobile- +919428104319 Website : http://rewarivishal.blogspot.com/ --- 19
[PHP] Server-side postscript-to-PDF on-the-fly conversion
Is there a free solution out there that will enable me to take a PHP-generated postscript output file, and dynamically, on-the-fly convert it to a PDF document and send to the user as a download when the user clients on a link? More description of what I'm trying to do: 1) I've got a web-page that accepts some user input 2) They hit SUBMIT 3) I've got a PHP file that takes that input and generates a custom Postscript file from it, which I presently serve back to the user. On a Mac, Safari and Firefox automatically take the .ps output and render it in Preview. 4) However, in the world of Windows, it seems like it'd be better to just convert it on-the-fly into a PDF, so that the user doesn't need to worry about having a post-script viewer app installed. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Server-side postscript-to-PDF on-the-fly conversion
Rob Gould wrote: Is there a free solution out there that will enable me to take a PHP-generated postscript output file, and dynamically, on-the-fly convert it to a PDF document and send to the user as a download when the user clients on a link? More description of what I'm trying to do: 1) I've got a web-page that accepts some user input 2) They hit SUBMIT 3) I've got a PHP file that takes that input and generates a custom Postscript file from it, which I presently serve back to the user. On a Mac, Safari and Firefox automatically take the .ps output and render it in Preview. 4) However, in the world of Windows, it seems like it'd be better to just convert it on-the-fly into a PDF, so that the user doesn't need to worry about having a post-script viewer app installed. Ghostscript is the first thing that comes to my mind; alternatively googling for convert postscript pdf or similar might turn up other options. Cheers -- David Robley To a cat, NO! means Not while I'm looking. Today is Sweetmorn, the 13rd day of Discord in the YOLD 3176. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Please guide in selection of Framework: according to your experience
On 03/27/2010 09:58 AM, Vishal Rewari wrote: Dear PHP community, I am vishal, I have recently started development in PHP I have come across these PHP frameworks: 1. Codeigniter 2. Symphony 3. CakePHP 4. PEAR Please guide me which one of them is *good in performance ? available functionality ? Easy to use and configure* or the one you would recommend according to your experience. My DB is MySQl, or should I stick to native call from PHP? Since you're new to PHP, you should not directly start off with frameworks. I agree, using frameworks makes the job infinite times easier, but as a learning point of view, you should first try to build some applications (not to sell or freelance!) from scratch without using any frameworks. You can of course use minimal PEAR packages. This way you will get a lot to know how to write efficient PHP code. Yes this will take time, but in future you may be one of the best developers coding PHP out there ! Lastly, PEAR isn't a framework, though combining various packages out there you can make one :) First try Zend, its the easiest to use as far I've seen. I have tried Symfony too, but I found it a little tougher to start with. -- Nilesh Govindarajan Site Server Administrator www.itech7.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php